diff --git a/.github/workflows/run-integration-test.yml b/.github/workflows/run-integration-test.yml index 1b857f45..ad46d7fd 100644 --- a/.github/workflows/run-integration-test.yml +++ b/.github/workflows/run-integration-test.yml @@ -101,6 +101,24 @@ jobs: --s3-bucket "${{ secrets.S3_BUCKET_LOG4J2_INTEG_TEST }}" \ --capabilities CAPABILITY_IAM \ 2>&1 | tee /tmp/sam-deploy.log | tail -n 20 + + # Verify stack is in a healthy state + STACK_STATUS=$(aws cloudformation describe-stacks \ + --stack-name "${stackName}" \ + --region "${AWS_REGION}" \ + --query 'Stacks[0].StackStatus' \ + --output text 2>&1) + echo "Stack status: $STACK_STATUS" + if [ "$STACK_STATUS" != "CREATE_COMPLETE" ] && [ "$STACK_STATUS" != "UPDATE_COMPLETE" ]; then + echo "FAIL: Stack is not in a healthy state (status: $STACK_STATUS)" + aws cloudformation describe-stack-events \ + --stack-name "${stackName}" \ + --region "${AWS_REGION}" \ + --query 'StackEvents[?ResourceStatus==`CREATE_FAILED` || ResourceStatus==`UPDATE_FAILED`].[LogicalResourceId,ResourceStatusReason]' \ + --output table 2>&1 || true + exit 1 + fi + LOG4J2_TEST_FUNCTION=$(sam list stack-outputs --stack-name "${stackName}" --output json | jq -r '.[] | select(.OutputKey=="Log4j2TestFunction") | .OutputValue') echo "LOG4J2_TEST_FUNCTION=$LOG4J2_TEST_FUNCTION" >> "$GITHUB_OUTPUT" echo "Function name: $LOG4J2_TEST_FUNCTION" diff --git a/lambda-integration-tests/samconfig.toml b/lambda-integration-tests/samconfig.toml index 5e659786..f1f665e4 100644 --- a/lambda-integration-tests/samconfig.toml +++ b/lambda-integration-tests/samconfig.toml @@ -12,7 +12,6 @@ lint = true [default.deploy.parameters] capabilities = "CAPABILITY_IAM" confirm_changeset = true -resolve_s3 = true [default.sync.parameters] watch = true diff --git a/lambda-integration-tests/template.yaml b/lambda-integration-tests/template.yaml index 01a10a70..a12e5f65 100644 --- a/lambda-integration-tests/template.yaml +++ b/lambda-integration-tests/template.yaml @@ -23,6 +23,7 @@ Resources: Metadata: BuildMethod: java21 Properties: + FunctionName: !Sub "${AWS::StackName}-fn" CodeUri: log4j2-test-function/ Handler: integ.Log4j2TestHandler::handleRequest Runtime: java21