Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
AE integration tests use unique version IDs (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Sloan authored Aug 31, 2017
1 parent 8600abd commit 3185cf2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
25 changes: 17 additions & 8 deletions scripts/ae_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ if [ -z "${imageUnderTest}" ]; then
exit 1
fi

# for local tests it makes sense sometimes to pin the deployment to an
# active version as that will speed up the deployment, for CI/CD this feature
# is not recommended
readonly gaeDeploymentVersion=$2
if [ "${gaeDeploymentVersion}" ]; then
DEPLOYMENT_OPTS="-v $gaeDeploymentVersion --no-promote"
DEPLOYMENT_VERSION_URL_PREFIX="$gaeDeploymentVersion-dot-"

# If provided, pin to a specific version. Otherwise, generate a random new version ID to prevent
# inadvertent collisions.
gaeDeploymentVersion=$2
if [ -z "${gaeDeploymentVersion}" ]; then
gaeDeploymentVersion=$(uuidgen)
readonly tearDown="true"
fi
DEPLOYMENT_OPTS="-v $gaeDeploymentVersion --no-promote --no-stop-previous-version"
DEPLOYMENT_VERSION_URL_PREFIX="$gaeDeploymentVersion-dot-"

# build the test app
pushd $testAppDir
Expand Down Expand Up @@ -77,3 +77,12 @@ gcloud container builds submit \
--substitutions "_DEPLOYED_APP_URL=$DEPLOYED_APP_URL" \
$dir

if [ "$tearDown" == "true" ]; then
# run a cleanup build once tests have finished executing
gcloud container builds submit \
--config $dir/integration_test_cleanup.yaml \
--substitutions "_VERSION=$gaeDeploymentVersion" \
--async \
--no-source
fi

5 changes: 5 additions & 0 deletions scripts/integration_test_cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Cloud Builder pipeline for tearing down integration test resources
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'versions', 'delete', '$_VERSION']

0 comments on commit 3185cf2

Please sign in to comment.