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

chore: add an integ test for deploy with notification ARNs #4539

Merged
merged 3 commits into from
Oct 17, 2019
Merged
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
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"