-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Added newNetwork method #9371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added newNetwork method #9371
Conversation
…lization Signed-off-by: dhoard <[email protected]>
|
Thanks @dhoard, I don't understand why you can't share the So what is the strong need for this?
|
|
@kiview The goal is to be able the verify the Network is created to prevent unnecessary work setting up multiple test containers (map/copy files, etc.) only for the network to fail. A —- Real world usage is testing the Prometheus JMX Exporter. |
|
Thanks for your contribution, @dhoard. This is the expected behavior and the workaround is valid. The lazy network initialization is how it is supposed to work. I think understanding the reason about the network not being created should be revisited instead. i.e. networks not being clean after test executions could be one reason. |
Summary
Added
Network.newNetwork(boolean initialize)method to force initialization on creation.Purpose
When writing integration tests, I want to confirm that the network has been created before proceeding.
The current API requires two method calls:
The new method would allow a single method call:
Real-world example
Prometheus JMX Exporter integration tests
Using the existing
netNetworkmethod:Reference:
https://github.com/prometheus/jmx_exporter/blob/89949413148adcfbc8ded41a2d931c8ef608ab2d/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/AbstractExporterTest.java#L65-L75
Using the new
newNetwork(boolean initialize)method: