Remove "Starting an elasticsearch container" message in constructor #6127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At this point in the constructor, we are not actually starting Elasticsearch, so this message can lead to confusion (it did for me, leading me to dig into it). I didn't find any of the other org.testcontainers container classes that output a message like this in their constructor.
When the container is actually started, we still get a log message from GenericContainer, anyway, so I think we can just safely delete this log line, which is what this PR does.
Notice line 8 where we have
Starting an elasticsearch container
:I can confirm that no Elasticsearch container has been created f I look at recently-created containers while the test is running. I don't see Elasticsearch, but I do see the other containers listed in the output above (and that I expect to see in this case):
ryuk
,postgres
, and OpenNMShorizon
.In our case, this happens because of the log message in the
ElasticsearchContainer
constructor, and also our smoke testOpenNMSStack
infrastructure that pre-defines a number of container stacks that we use in tests, one of which calledALEC
includes Elasticsearch (code). However in the test output I showed above, it wasn't theALEC
stack that was being used--anElasticsearchContainer
object was instantiated, but the container was never actually created or started in this case.