-
Notifications
You must be signed in to change notification settings - Fork 5
DT-1194: Speed up integration tests by running them in parallel #1896
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
Changes from all commits
c49d0a1
3f9f507
3b3f3f3
745ea66
587b22d
2c11234
3797f55
5db6e56
8936b03
731142a
4c6196a
e8c1e89
57f6ee3
83ba235
b7f4cb2
d7171be
d897097
6b0bb49
1cd45e3
c2a3474
274fda2
270d479
1babe2d
c3464ff
6afd840
117b5b5
bb20139
0a79c38
a165a85
b3668b3
58252cf
0c1e42f
af71817
d544f3a
8a4edf5
2356f3f
908fbcf
547e49a
64ebcde
d675c1c
e4cbf25
31cd7fd
a77bde9
3f725c2
ac802eb
da24845
763b0c1
dadfd2e
96c3d71
90111ad
86b4d4b
d2c0c8d
ed3f2bf
cfada0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ services: | |
- GOOGLE_SA_CERT | ||
- RBS_POOLID | ||
- RBS_INSTANCEURL | ||
- TDR_LOG_APPENDER | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enable passthrough to support non-json logging in the TDR container |
||
ports: | ||
- "8080:8080" | ||
volumes: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,9 @@ source "$(dirname "$0")"/init.sh | |
die() { log_error "$*" >&2; echo ""; usage; exit 2; } # complain to STDERR and exit with error | ||
needs_arg() { if [ -z "$OPTARG" ]; then die "No arg for --$OPT option"; fi; } | ||
|
||
# output plain logs instead of json | ||
export TDR_LOG_APPENDER=Console-Standard | ||
|
||
while getopts h-: OPT; do | ||
# support long options: https://stackoverflow.com/a/28466267/519360 | ||
if [ "$OPT" = "-" ]; then # long option: reformulate OPT and OPTARG | ||
|
@@ -51,17 +54,24 @@ RUNTYPE=${1} | |
|
||
run_tests() { | ||
cd "${ROOT_DIR}" | ||
eval "$("${SCRIPTS_DIR}"/render-configs.sh -e)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed for both unit and connected tests as well, since these depend on |
||
|
||
# shellcheck disable=SC2086 # The array syntax and quoting seems to break gradle | ||
./gradlew testUnit ${GRADLE_ARGS} | ||
|
||
#./gradlew --build-cache srcclr | ||
} | ||
|
||
wait_until_server_up() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without this, integration tests would sometimes fail as the server wasn't up by the time the tests started running. |
||
timeout 60 bash -c "until curl -s http:/localhost:8080/status; do sleep 1; done" | ||
} | ||
|
||
run_integration_tests() { | ||
TEST_ENV=${TEST_ENV:-local} | ||
|
||
cd "${ROOT_DIR}" | ||
start_docker integration | ||
wait_until_server_up | ||
# shellcheck disable=SC2086 # The array syntax and quoting seems to break gradle | ||
./gradlew testIntegration ${GRADLE_ARGS} | ||
|
||
|
@@ -75,6 +85,8 @@ run_connected_tests() { | |
TEST_ENV=${TEST_ENV:-local} | ||
|
||
cd "${ROOT_DIR}" | ||
eval "$("${SCRIPTS_DIR}"/render-configs.sh -e)" | ||
|
||
# shellcheck disable=SC2086 # The array syntax and quoting seems to break gradle | ||
./gradlew testConnected ${GRADLE_ARGS} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
usage() { | ||
cat <<-'EOF' | ||
usage: run-db [--clean-db] [-h|--help] COMMAND | ||
[--clean-db] clean the database | ||
[--clean-db] clean the database (only with `stop` or `start`) | ||
[-h|--help] print this help text | ||
COMMAND is one of: | ||
- start start a local database server | ||
|
@@ -34,8 +34,6 @@ while getopts hc-: OPT; do # allow -h and -- "with arg" | |
# support long options: https://stackoverflow.com/a/28466267/519360 | ||
if [ "$OPT" = "-" ]; then # long option: reformulate OPT and OPTARG | ||
OPT="${OPTARG%%=*}" # extract long option name | ||
OPTARG="${OPTARG#"$OPT"}" # extract long option argument (may be empty) | ||
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=` | ||
fi | ||
case "$OPT" in | ||
c | clean-db ) clean_db=true ;; | ||
|
@@ -53,7 +51,7 @@ COMMAND=$1 | |
remove_database() { | ||
if [ "$clean_db" = "true" ]; then | ||
log_info "erasing existing database state" | ||
rm -r "$TMP_DIR"/postgres-data | ||
rm -r "$ROOT_DIR"/build/tmp/postgres-data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the actual location of the container's database, see https://github.com/DataBiosphere/jade-data-repo/blob/develop/scripts/compose.yaml#L36 |
||
fi | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,12 @@ | |
import bio.terra.stairway.FlightMap; | ||
import bio.terra.stairway.Step; | ||
import bio.terra.stairway.StepResult; | ||
import bio.terra.stairway.StepStatus; | ||
import java.util.UUID; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.dao.TransientDataAccessException; | ||
import org.springframework.transaction.TransactionSystemException; | ||
|
||
public class CreateDatasetGetOrCreateStorageAccountStep implements Step { | ||
private static Logger logger = | ||
|
@@ -40,11 +43,16 @@ public StepResult doStep(FlightContext context) throws InterruptedException { | |
workingMap.get(ProfileMapKeys.PROFILE_MODEL, BillingProfileModel.class); | ||
UUID datasetId = workingMap.get(DatasetWorkingMapKeys.DATASET_ID, UUID.class); | ||
|
||
AzureStorageAccountResource storageAccount = | ||
resourceService.getOrCreateDatasetStorageAccount( | ||
DatasetJsonConversion.datasetRequestToDataset(datasetRequestModel, datasetId), | ||
profileModel, | ||
context.getFlightId()); | ||
AzureStorageAccountResource storageAccount; | ||
try { | ||
storageAccount = | ||
resourceService.getOrCreateDatasetStorageAccount( | ||
DatasetJsonConversion.datasetRequestToDataset(datasetRequestModel, datasetId), | ||
profileModel, | ||
context.getFlightId()); | ||
} catch (TransientDataAccessException | TransactionSystemException e) { | ||
return new StepResult(StepStatus.STEP_RESULT_FAILURE_RETRY, e); | ||
} | ||
Comment on lines
+53
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there were a different exception thrown, could There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a different exception was thrown, it wouldn't be caught by the Either the |
||
|
||
logger.info("Enabling Azure storage account logging"); | ||
// Log files will reside in the storage account's $logs container | ||
|
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 is required to enable concurrent test execution. If we decide to use concurrent execution for other test types (like connected tests) this configuration can be moved to a shared scope, or moved to a property file.
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.
Is it the case that this just allows for parallel execution and tests still need to explicitly make use of it?