Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only configure shared network for Elasticsearch containers where nece…
…ssary When a shared network is configured, the configuration will change on each container start because of this: https://github.com/quarkusio/quarkus/blob/cd90a560cfcf1bd1be4992bae9a1f68287e98623/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/ConfigureUtil.java#L46 This will result in the config hash being different on each start in testcontainers, and ultimately in testcontainers not reusing containers. Fortunately, we're not supposed to enabled shared networks most of the time; it was wrong that we were. With these changes, I get this, and it's a delight: ``` 2024-02-09 16:52:37,708 INFO [tc.doc.io/.9.1] (build-13) Creating container for image: docker.io/elastic/elasticsearch:8.9.1 2024-02-09 16:52:37,770 INFO [tc.doc.io/.9.1] (build-13) Reusing container with ID: 20656c74bf8ec5f88281d07d8ecc6643e1262f1bd90952d9c7353eb7a9d9821a and hash: 07fc5c4abe6432c92163095b5c1283d79f778e14 2024-02-09 16:52:37,771 INFO [tc.doc.io/.9.1] (build-13) Reusing existing container (20656c74bf8ec5f88281d07d8ecc6643e1262f1bd90952d9c7353eb7a9d9821a) and not creating a new one 2024-02-09 16:52:37,919 INFO [tc.doc.io/.9.1] (build-13) Container docker.io/elastic/elasticsearch:8.9.1 started in PT0.210882132S ``` Obviously this doesn't solve the problem when shared networks are required (e.g. when running the app as a container for @QuarkusIntegrationTest), but then this is a more general problem that probably affects all containers, not just Elasticsearch.
- Loading branch information