Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sumeet-kg
Copy link

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.

@sumeet-kg sumeet-kg changed the title Delated Startup check Strategy Added for common use Delayed Startup check Strategy Added for common use Nov 23, 2022
@ravidesai47
Copy link
Contributor

LGTM

log.error("Unable to pause thread", e);
}

return super.checkStartupState(dockerClient, containerId);
Copy link
Contributor

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());
Copy link
Contributor

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants