Skip to content

Commit

Permalink
✅ [Job] Improved test execution time of Job Engine services
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Codutti <alberto.codutti@eurotech.com>
  • Loading branch information
Coduz committed Dec 17, 2024
1 parent c873127 commit 4b563dc
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
*******************************************************************************/
package org.eclipse.kapua.qa.integration.steps;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import com.google.inject.Singleton;
Expand Down Expand Up @@ -49,7 +47,6 @@

import javax.inject.Inject;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
Expand Down Expand Up @@ -254,30 +251,54 @@ public void startDockerEnvironmentWithResources(List<String> dockerContainers) t

for (String dockerContainer : dockerContainers) {
switch (dockerContainer) {
case "db":
case "db": {
startDBContainer(BasicSteps.DB_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_DB);
}
break;
case "es":
} break;
case "es": {
startESContainer(BasicSteps.ES_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_ES);
}
break;
case "events-broker":
} break;
case "events-broker": {
startEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_EVENTS_BROKER);
}
break;
case "job-engine":
} break;
case "job-engine": {
startJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_JOB_ENGINE);
}
break;
} break;
case "message-broker": {
startMessageBrokerContainer(BasicSteps.MESSAGE_BROKER_CONTAINER_NAME);
synchronized (this) {
this.wait(WAIT_FOR_BROKER);
}
} break;
case "broker-auth-service": {
startAuthServiceContainer(BasicSteps.AUTH_SERVICE_CONTAINER_NAME);

long timeout = System.currentTimeMillis();
while (System.currentTimeMillis() - timeout < 30000) {
isServiceReady(AUTH_SERVICE_CHECK_WEB_APP);
Thread.sleep(500);
}
} break;
case "consumer-lifecycle": {
startLifecycleConsumerContainer(BasicSteps.LIFECYCLE_CONSUMER_CONTAINER_NAME);

long timeout = System.currentTimeMillis();
while (System.currentTimeMillis() - timeout < 30000) {
isServiceReady(LIFECYCLE_CHECK_WEB_APP);
Thread.sleep(500);
}
} break;
default:
throw new UnsupportedOperationException("Unknown container resource: " + dockerContainer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@
Feature: Job Engine Service - Keystore Step Definitions

@setup
Scenario: Start full docker environment
Given Init Jaxb Context
And Init Security Context
And Start full docker environment
Scenario: Setup test resources
Given Init Security Context
And Init Jaxb Context
And Start Docker environment with resources
| db |
| events-broker |
| job-engine |
| message-broker |
| broker-auth-service |
| consumer-lifecycle |

#
# Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
Feature: JobEngineService tests for restarting job with offline device

@setup
Scenario: Start full docker environment
Given Init Jaxb Context
And Init Security Context
And Start full docker environment
Scenario: Setup test resources
Given Init Security Context
And Init Jaxb Context
And Start Docker environment with resources
| db |
| events-broker |
| job-engine |
| message-broker |
| broker-auth-service |
| consumer-lifecycle |

# *************************************************
# * Restarting a job with one Target and one Step *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
Feature: JobEngineService restart job tests with online device

@setup
Scenario: Start full docker environment
Given Init Jaxb Context
And Init Security Context
And Start full docker environment
Scenario: Setup test resources
Given Init Security Context
And Init Jaxb Context
And Start Docker environment with resources
| db |
| events-broker |
| job-engine |
| message-broker |
| broker-auth-service |
| consumer-lifecycle |

# *************************************************
# * Restarting a job with one Target and one Step *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
Feature: JobEngineService restart job tests with online device - second part

@setup
Scenario: Start full docker environment
Given Init Jaxb Context
And Init Security Context
And Start full docker environment
Scenario: Setup test resources
Given Init Security Context
And Init Jaxb Context
And Start Docker environment with resources
| db |
| events-broker |
| job-engine |
| message-broker |
| broker-auth-service |
| consumer-lifecycle |

# *************************************************
# * Restarting a job with one Target and one Step *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
Feature: JobEngineService tests for starting job with offline device

@setup
Scenario: Start full docker environment
Given Init Jaxb Context
And Init Security Context
And Start full docker environment
Scenario: Setup test resources
Given Init Security Context
And Init Jaxb Context
And Start Docker environment with resources
| db |
| events-broker |
| job-engine |
| message-broker |
| broker-auth-service |
| consumer-lifecycle |

# ***********************************************
# * Starting a job with one Target and one Step *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
Feature: JobEngineService start job tests with online device

@setup
Scenario: Start full docker environment
Given Init Jaxb Context
And Init Security Context
And Start full docker environment
Scenario: Setup test resources
Given Init Security Context
And Init Jaxb Context
And Start Docker environment with resources
| db |
| events-broker |
| job-engine |
| message-broker |
| broker-auth-service |
| consumer-lifecycle |

# ***********************************************
# * Starting a job with one Target and one Step *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ Feature: JobEngineService stop job tests with online device
one target and multiple steps, multiple targets and one step and multiple targets and multiple steps.

@setup
Scenario: Start full docker environment
Given Init Jaxb Context
And Init Security Context
And Start full docker environment
Scenario: Setup test resources
Given Init Security Context
And Init Jaxb Context
And Start Docker environment with resources
| db |
| events-broker |
| job-engine |
| message-broker |
| broker-auth-service |
| consumer-lifecycle |

# *****************************************************
# * Stopping a job with one Target and multiple Steps *
Expand Down

0 comments on commit 4b563dc

Please sign in to comment.