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 7 months 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