Skip to content

Commit

Permalink
♻️ [Test] Improved wait times and cleanup of code
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Codutti <[email protected]>
  • Loading branch information
Coduz committed Jan 20, 2025
1 parent 76a7de1 commit 4bd1141
Showing 1 changed file with 12 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public class DockerSteps {
private static final List<String> DEFAULT_BASE_DEPLOYMENT_CONTAINERS_NAME;
private static final int WAIT_COUNT = 120; //total wait time = 240 secs (120 * 2000ms)
private static final long WAIT_STEP = 2000;
private static final long WAIT_FOR_DB = 10000;
private static final long WAIT_FOR_ES = 10000;
private static final long WAIT_FOR_EVENTS_BROKER = 10000;
private static final long WAIT_FOR_DB = 5000;
private static final long WAIT_FOR_ES = 5000;
private static final long WAIT_FOR_EVENTS_BROKER = 5000;
private static final long WAIT_FOR_JOB_ENGINE = 20000;
private static final long WAIT_FOR_REST_API = 30000;
private static final long WAIT_FOR_BROKER = 30000;
Expand Down Expand Up @@ -210,9 +210,7 @@ public void startFullDockerEnvironment() throws Exception {
startBaseDockerEnvironmentInternal();
try {
startMessageBrokerContainer(BasicSteps.MESSAGE_BROKER_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_BROKER);
}
waitMessageBrokerContainer(BasicSteps.MESSAGE_BROKER_CONTAINER_NAME);

startAuthServiceContainer(BasicSteps.AUTH_SERVICE_CONTAINER_NAME);
startLifecycleConsumerContainer(BasicSteps.LIFECYCLE_CONSUMER_CONTAINER_NAME);
Expand Down Expand Up @@ -360,24 +358,16 @@ private void startBaseDockerEnvironmentInternal() throws Exception {
createNetwork();

startDBContainer(BasicSteps.DB_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_DB);
}
waitDBContainer(BasicSteps.DB_CONTAINER_NAME);

startESContainer(BasicSteps.ES_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_ES);
}
waitEsContainer(BasicSteps.ES_CONTAINER_NAME);

startEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_EVENTS_BROKER);
}
waitEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME);

startJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_JOB_ENGINE);
}
waitJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME);

} catch (Exception e) {
logger.error("Error while starting base docker environment: {}", e.getMessage(), e);
Expand All @@ -394,24 +384,16 @@ public void startApiDockerEnvironment(String tokenTTL, String refreshTokenTTL, i
createNetwork();

startDBContainer(BasicSteps.DB_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_DB);
}
waitDBContainer(BasicSteps.DB_CONTAINER_NAME);

startEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_EVENTS_BROKER);
}
waitEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME);

startJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_JOB_ENGINE);
}
waitJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME);

startAPIContainer(BasicSteps.API_CONTAINER_NAME, tokenTTL, refreshTokenTTL, corsEndpointRefreshInterval);
synchronized (this) {
this.wait(WAIT_FOR_JOB_ENGINE);
}
waitRestApiContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME);

} catch (Exception e) {
logger.error("Error while starting base docker environment: {}", e.getMessage(), e);
Expand Down

0 comments on commit 4bd1141

Please sign in to comment.