-
Notifications
You must be signed in to change notification settings - Fork 9
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
Delayed Startup check Strategy Added for common use #20
base: master
Are you sure you want to change the base?
Conversation
LGTM |
log.error("Unable to pause thread", e); | ||
} | ||
|
||
return super.checkStartupState(dockerClient, containerId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be wrong way to do this. Ideally the check should be done in a retry loop with timeout and backoff for some time, instead of just dead wait for some time and checking once? this will just make tests slow even for cases where the container actually starts up fast enough and severely limits the use cases for this
@@ -27,7 +28,8 @@ public RabbitMQContainer(final RabbitMQContainerConfiguration rabbitMQContainerC | |||
.withExposedPorts(rabbitMQContainerConfiguration.getPort(), rabbitMQContainerConfiguration.getManagementPort()) | |||
.withLogConsumer(ContainerUtils.containerLogsConsumer(log)) | |||
.waitingFor(new RabbitMQStatusCheck(rabbitMQContainerConfiguration)) | |||
.withStartupTimeout(rabbitMQContainerConfiguration.getTimeoutDuration()); | |||
.withStartupTimeout(rabbitMQContainerConfiguration.getTimeoutDuration()) | |||
.withStartupCheckStrategy(new IsRunningStartupCheckStrategyWithDelay()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This basically fixes a startup delay of 1 second blindly. Make this configurable as a constructor actually exists for doing this. getTimeoutDuration
should ideally be deprecated or ignored if this is used or use the timeout to configure the retrier (see above comment) in the strategy..
Sometimes the test container startup checks fails due to container not up or busy in acquiring IO resources.
This delay startup check strategy is used to check the state after a
{delayInMilliSec}
ms delay.