Skip to content

feat(otel): Add X-Ray e2e integration tests for span validation #908

feat(otel): Add X-Ray e2e integration tests for span validation

feat(otel): Add X-Ray e2e integration tests for span validation #908

Workflow file for this run

name: E2E Tests
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- '.github/**' # for testing Github Actions
- 'sdk/**'
- 'sdk-testing/**'
- 'sdk-integration-tests/**'
- 'examples/**'
- 'pom.xml'
push:
branches:
- main
paths:
- '.github/**'
- 'sdk/**'
- 'sdk-testing/**'
- 'sdk-integration-tests/**'
- 'examples/**'
- 'pom.xml'
concurrency:
group: e2e-tests
cancel-in-progress: false
# permission can be added at job level or workflow level
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
e2e-tests:
env:
AWS_REGION: us-west-2
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java:
- 17
- 21
- 25
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup AWS SAM CLI
uses: aws-actions/setup-sam@v3
with:
use-installer: true
# token: ${{ secrets.GITHUB_TOKEN }} # only enable if we run into throughput issues
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6.2.0
with:
role-to-assume: "${{ secrets.ACTIONS_INTEGRATION_ROLE_NAME }}"
role-session-name: java-language-sdk-test
aws-region: ${{ env.AWS_REGION }}
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v5
with:
distribution: corretto
java-version: ${{ matrix.java }}
cache: maven
- name: Build locally
run: mvn -B -q -Dmaven.test.skip=true install --file pom.xml
- name: sam build
run: | # add --no-cached if debugging sam build
sam build --debug --parameter-overrides \
'ParameterKey=Architecture,ParameterValue=x86_64 ParameterKey=JavaVersion,ParameterValue=java${{ matrix.java }} ParameterKey=RoleArn,ParameterValue=${{ secrets.DURABLE_INTEGRATION_TEST_ROLE_ARN }}'
working-directory: ./examples
- name: Clean up stuck stack if needed
run: |
STACK_NAME="JavaSDKCloudBasedIntegrationTestStack-Java${{ matrix.java }}Runtime"
STATUS=$(aws cloudformation describe-stacks --stack-name "${STACK_NAME}" --query 'Stacks[0].StackStatus' --output text 2>/dev/null || echo "NOT_FOUND")
echo "Stack status: ${STATUS}"
if [[ "${STATUS}" == "UPDATE_FAILED" || "${STATUS}" == "UPDATE_ROLLBACK_FAILED" ]]; then
echo "Stack is in ${STATUS} state, attempting rollback..."
# Get resources that failed to update
FAILED_RESOURCES=$(aws cloudformation describe-stack-resources --stack-name "${STACK_NAME}" \
--query "StackResources[?ResourceStatus=='UPDATE_FAILED'].LogicalResourceId" --output text)
echo "Failed resources: ${FAILED_RESOURCES}"
SKIP_ARGS=""
for r in ${FAILED_RESOURCES}; do
SKIP_ARGS="${SKIP_ARGS} ${r}"
done
if [ -n "${SKIP_ARGS}" ]; then
aws cloudformation continue-update-rollback --stack-name "${STACK_NAME}" --resources-to-skip ${SKIP_ARGS}
else
aws cloudformation continue-update-rollback --stack-name "${STACK_NAME}"
fi
echo "Waiting for rollback to complete..."
aws cloudformation wait stack-rollback-complete --stack-name "${STACK_NAME}"
echo "Rollback complete, deleting stack..."
aws cloudformation delete-stack --stack-name "${STACK_NAME}"
aws cloudformation wait stack-delete-complete --stack-name "${STACK_NAME}"
echo "Stack deleted, SAM will create fresh"
elif [ "${STATUS}" = "DELETE_FAILED" ]; then
echo "Stack is in DELETE_FAILED state, retrying with retain..."
FAILED_RESOURCES=$(aws cloudformation describe-stack-resources --stack-name "${STACK_NAME}" \
--query "StackResources[?ResourceStatus=='DELETE_FAILED'].LogicalResourceId" --output text)
RETAIN_ARGS=""
for r in ${FAILED_RESOURCES}; do
RETAIN_ARGS="${RETAIN_ARGS} ${r}"
done
aws cloudformation delete-stack --stack-name "${STACK_NAME}" --retain-resources ${RETAIN_ARGS}
aws cloudformation wait stack-delete-complete --stack-name "${STACK_NAME}"
echo "Stack deleted, SAM will create fresh"
fi
- name: sam deploy
run: |
sam deploy --stack-name JavaSDKCloudBasedIntegrationTestStack-Java${{ matrix.java }}Runtime \
--resolve-image-repos --resolve-s3 --parameter-overrides \
'ParameterKey=Architecture,ParameterValue=x86_64 ParameterKey=JavaVersion,ParameterValue=java${{ matrix.java }} ParameterKey=RoleArn,ParameterValue=${{ secrets.DURABLE_INTEGRATION_TEST_ROLE_ARN }}'
working-directory: ./examples
- name: Cloud Based Integration Tests
run: mvn clean test -B -Dtest.cloud.enabled=true -Dtest=CloudBasedIntegrationTest -Dtest.function.name.suffix='-java${{ matrix.java }}-runtime'
working-directory: ./examples