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

Support end-to-end integration tests on Jenkins #163

Merged
merged 2 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2022, California Institute of Technology ("Caltech").
* Copyright © 2022–2023, California Institute of Technology ("Caltech").
* U.S. Government sponsorship acknowledged.
*
* All rights reserved.
Expand Down Expand Up @@ -81,11 +81,11 @@ pipeline {
// a custom application.properties file and/or `docker-compose.yaml` file.
}
}
stage('🩺 Test') {
// The repository's upstream projects have already tested everything—there's nothing that needs
// to be done; However, we include the stage for reporting purposes (all pipelines should have a
// test stage.
stage('🩺 Unit Test') {
steps {
// The repository's upstream projects have already tested everything—there's nothing that needs
// to be done; However, we include the stage for reporting purposes (all pipelines should have a
// unit test stage.
echo 'No-op test step: ✓'
}
}
Expand All @@ -103,5 +103,20 @@ pipeline {

// 🔮 TODO: Include a `post {…}` block to do post-deployment test queries?
}
stage('🏃 Integration Test') {
steps {
dir("${env.WORKSPACE}/docker") {
// 🔮 TODO: It'd be better if the Docker Composition could also indicate it's completed
// setup. Maybe add yet another quasi-service to it that waits for all the other
// services?
//
// For now, we wait:
sleep(time: 5, unit: "MINUTES");

// Then test:
sh "$compose run --rm reg-api-integration-test"
}
}
}
}
}
8 changes: 7 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,13 @@ services:

# Executes Registry API integration test as a Postman collection with test data (after waiting for data to be loaded)
reg-api-integration-test-with-wait:
profiles: ["int-registry-batch-loader", "int-registry-service-loader"]
# For deep-archive#138, @nutjob4life writes:
# I'm changing this to no profiles, because I'm not sure if it's actually useful to run any
# tests at this point. The two profiles `int-registry-batch-loader` and `int-registry-service-loader`
# are typically run with `--detach` and so any exit codes they might have to show pass/fail
# status of the tests are lost. We can always run the tests with `./int-tests.sh`.
# profiles: ["int-registry-batch-loader", "int-registry-service-loader"]
profiles: []
image: ${POSTMAN_NEWMAN_IMAGE}
environment:
- REG_API_URL=${REG_API_URL}
Expand Down
2 changes: 1 addition & 1 deletion docker/int-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
# -----------------------------------------------------------------------------------------------------

# Execute Postman integration tests with docker compose
docker compose run reg-api-integration-test
docker compose run --rm reg-api-integration-test