testcontainers-rs-modules-community
testcontainers-rs-modules-community copied to clipboard
refactor!: require the builder pattern for module initalisation
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() |
Let's clean this up (rustfmt & etc)
Sorry for that part. Forgot to do rustfmt after doing the (apparently missing doctests) testing run
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?
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