Skip to content

Commit 3af9bdf

Browse files
author
Fabiana Severin
committed
fix: verify stack status after deploy before running tests
1 parent fff1ffc commit 3af9bdf

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/run-integration-test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,24 @@ jobs:
101101
--s3-bucket "${{ secrets.S3_BUCKET_LOG4J2_INTEG_TEST }}" \
102102
--capabilities CAPABILITY_IAM \
103103
2>&1 | tee /tmp/sam-deploy.log | tail -n 20
104+
105+
# Verify stack is in a healthy state
106+
STACK_STATUS=$(aws cloudformation describe-stacks \
107+
--stack-name "${stackName}" \
108+
--region "${AWS_REGION}" \
109+
--query 'Stacks[0].StackStatus' \
110+
--output text 2>&1)
111+
echo "Stack status: $STACK_STATUS"
112+
if [ "$STACK_STATUS" != "CREATE_COMPLETE" ] && [ "$STACK_STATUS" != "UPDATE_COMPLETE" ]; then
113+
echo "FAIL: Stack is not in a healthy state (status: $STACK_STATUS)"
114+
aws cloudformation describe-stack-events \
115+
--stack-name "${stackName}" \
116+
--region "${AWS_REGION}" \
117+
--query 'StackEvents[?ResourceStatus==`CREATE_FAILED` || ResourceStatus==`UPDATE_FAILED`].[LogicalResourceId,ResourceStatusReason]' \
118+
--output table 2>&1 || true
119+
exit 1
120+
fi
121+
104122
LOG4J2_TEST_FUNCTION=$(sam list stack-outputs --stack-name "${stackName}" --output json | jq -r '.[] | select(.OutputKey=="Log4j2TestFunction") | .OutputValue')
105123
echo "LOG4J2_TEST_FUNCTION=$LOG4J2_TEST_FUNCTION" >> "$GITHUB_OUTPUT"
106124
echo "Function name: $LOG4J2_TEST_FUNCTION"

0 commit comments

Comments
 (0)