Skip to content

Commit

Permalink
fix(integ): fix broken CDK app deny-list and error handling (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
jusiskin authored May 18, 2021
1 parent 2e52314 commit cfcb9bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ EOF
# Clean-up if test failed
if [[ $test_exit_code -ne 0 ]]
then
# A failed cleanup should propagate to the calling process
set -e
../common/scripts/bash/component_e2e.sh "$COMPONENT_NAME" --destroy-only
fi

Expand Down
21 changes: 12 additions & 9 deletions integ/scripts/bash/rfdk-integ-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ export PRETEST_FINISH_TIME=$SECONDS

# Define cleanup function for deployment failure
cleanup_on_failure () {
echo "Testing failed. Performing failure cleanup..."
echo "Performing best-effort full cleanup..."
yarn run tear-down
exit 1
}

get_component_dirs () {
Expand All @@ -85,13 +84,17 @@ get_component_dirs () {
xargs -n1 dirname | \
# Filter out apps whose driectories begin with an underscore (_) as this
# convention indicates the app is not a test
egrep -v "^_" | \
grep -v "/_" | \
# Sort
sort
}

# Deploy the infrastructure app, a cdk app containing only a VPC to be supplied to the following tests
$BASH_SCRIPTS/deploy-infrastructure.sh || cleanup_on_failure
$BASH_SCRIPTS/deploy-infrastructure.sh || (
echo "[infrastructure] Error deploying infrastructure"
cleanup_on_failure
false
)

# Mark infrastructure deploy finish time
export INFRASTRUCTURE_DEPLOY_FINISH_TIME=$SECONDS
Expand All @@ -104,16 +107,16 @@ then
fi

# Run the component tests (potentially in parallel)
get_component_dirs | xargs ${XARGS_ARGS} components/deadline/common/scripts/bash/component_e2e_driver.sh || cleanup_on_failure
get_component_dirs | xargs ${XARGS_ARGS} components/deadline/common/scripts/bash/component_e2e_driver.sh

# Destroy the infrastructure stack on completion
cd $INTEG_ROOT
export INFRASTRUCTURE_DESTROY_START_TIME=$SECONDS # Mark infrastructure destroy start time
$BASH_SCRIPTS/teardown-infrastructure.sh || cleanup_on_failure
$BASH_SCRIPTS/teardown-infrastructure.sh || (
echo '[infrastructure] Error destroying infrastructure'
cleanup_on_failure || true
)
export INFRASTRUCTURE_DESTROY_FINISH_TIME=$SECONDS # Mark infrastructure destroy finish time

cd "$INTEG_ROOT"

echo "Complete!"

# Report results
Expand Down

0 comments on commit cfcb9bb

Please sign in to comment.