-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add an integ test for deploy with notification ARNs (#4539)
- Loading branch information
1 parent
eeb5ae9
commit f7ea9dd
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
packages/aws-cdk/test/integ/cli/test-cdk-deploy-with-notification-arns.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |