testcontainers-rs-modules-community icon indicating copy to clipboard operation
testcontainers-rs-modules-community copied to clipboard

refactor!: require the builder pattern for module initalisation

Open CommanderStorm opened this issue 1 year ago • 3 comments

This PR makes sure that the way structs are constructed is consistent and encourages the builder pattern. It is based on this question: https://github.com/testcontainers/testcontainers-rs-modules-community/pull/156#discussion_r1660236432

For the changelog:

We now require you to use the builder pattern (instead of some structs being unit structs) for all modules. This ensures that if we add a field in the future that this will not break your existing code.

This change is breaking for these modules:

Module before after
cncf_distribution::CncfDistribution CncfDistribution.start() CncfDistribution::default().start()
dynamodb_local::DynamoDb DynamoDb.start() DynamoDb::default().start()
elasticmq::ElasticMq ElasticMq.start() ElasticMq::default().start()
~mongo::Mongo~ (see #143) ~Mongo.start()~ ~Mongo::default().start()~
kwok::KwokCluster KwokCluster.start() KwokCluster::default().start()
rabbitmq::RabbitMq RabbitMq.start() RabbitMq::default().start()
redis::stack::RedisStack RedisStack.start() RedisStack::default().start()
redis::standalone::Redis Redis.start() Redis::default().start()
victoria_metrics::VictoriaMetrics VictoriaMetrics.start() VictoriaMetrics::default().start()

CommanderStorm avatar Jul 07 '24 16:07 CommanderStorm

Let's clean this up (rustfmt & etc)

Sorry for that part. Forgot to do rustfmt after doing the (apparently missing doctests) testing run

CommanderStorm avatar Jul 07 '24 18:07 CommanderStorm

I don't know why the test for mssql_server added in https://github.com/testcontainers/testcontainers-rs-modules-community/pull/72 is failing.

Cannot debug this locally. @kymmt90 I am assuming you are using this in your testing infra. Is this flaky for you too?

CommanderStorm avatar Jul 07 '24 19:07 CommanderStorm

It's definitely not related to this PR and seems flaky - yes. For some reason, I think it happens only on nightly channel (might be coincidence though) 🤔

Need to address this but in separate PR for sure

DDtKey avatar Jul 07 '24 20:07 DDtKey