Skip to content

Commit

Permalink
chore: add an integ test for deploy with notification ARNs (#4539)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivlaks authored and mergify[bot] committed Oct 17, 2019
1 parent eeb5ae9 commit f7ea9dd
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -euo pipefail
scriptdir=$(cd $(dirname $0) && pwd)
source ${scriptdir}/common.bash
# ----------------------------------------------------------
sns_topic_name=${STACK_NAME_PREFIX}-test-topic

response_json=$(mktemp).json
aws sns create-topic --name ${sns_topic_name} > ${response_json}
sns_arn=$(node -e "console.log(require('${response_json}').TopicArn)")

setup

stack_arn=$(cdk deploy ${STACK_NAME_PREFIX}-test-2 --notification-arns ${sns_arn})
echo "Stack deployed successfully"

# verify that the stack we deployed has our notification ARN
aws cloudformation describe-stacks --stack-name ${stack_arn} > ${response_json}

notification_count=$(node -e "console.log(require('${response_json}').Stacks[0].NotificationARNs.length)")
if [[ "${notification_count}" -ne 1 ]]; then
fail "stack has ${notification_count} SNS notification ARNs, and we expected one"
fi

notification_arn=$(node -e "console.log(require('${response_json}').Stacks[0].NotificationARNs[0])")
if [[ "${notification_arn}" != "${sns_arn}" ]]; then
fail "stack has ${notification_arn} SNS notification ARN, and we expected ${sns_arn}"
fi

# destroy stack and delete SNS topic
cdk destroy -f ${STACK_NAME_PREFIX}-test-2
aws sns delete-topic --topic-arn ${sns_arn}

echo "✅ success"

0 comments on commit f7ea9dd

Please sign in to comment.