Skip to content

Commit fe1283a

Browse files
chore: split e2e workflow into PR-focused and weekly full suite (#367)
* chore: split e2e workflow into PR-focused and weekly full suite Run only 4 focused tests (strands-bedrock, strands-openai, langgraph-bedrock, googleadk-gemini) on PRs for fast feedback. Add a weekly workflow that runs the full e2e suite every Monday at 9 AM EST. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clean up API key credential providers in e2e test teardown The e2e afterAll was only tearing down CDK stacks but not deleting the API key credential providers created as a pre-deploy step. This caused providers to accumulate and hit the account limit, failing all non-Bedrock tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 26c1b5b commit fe1283a

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: E2E Tests (Weekly Full Suite)
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
aws_region:
6+
description: 'AWS region for deployment'
7+
default: 'us-east-1'
8+
schedule:
9+
- cron: '0 14 * * 1' # Every Monday at 9 AM EST (14:00 UTC)
10+
11+
permissions:
12+
id-token: write # OIDC — lets GitHub assume an AWS IAM role via short-lived token (no stored keys)
13+
contents: read
14+
15+
jobs:
16+
e2e:
17+
runs-on: ubuntu-latest
18+
environment: e2e-testing
19+
timeout-minutes: 60
20+
steps:
21+
- uses: actions/checkout@v6
22+
with:
23+
ref: main
24+
- uses: actions/setup-node@v6
25+
with:
26+
node-version: '20.x'
27+
cache: 'npm'
28+
- name: Configure git
29+
run: |
30+
git config --global user.email "ci@amazon.com"
31+
git config --global user.name "CI"
32+
- uses: astral-sh/setup-uv@v5
33+
- name: Configure AWS credentials
34+
uses: aws-actions/configure-aws-credentials@v4
35+
with:
36+
role-to-assume: ${{ secrets.E2E_AWS_ROLE_ARN }}
37+
aws-region: ${{ inputs.aws_region || 'us-east-1' }}
38+
- name: Get AWS Account ID
39+
id: aws
40+
run: echo "account_id=$(aws sts get-caller-identity --query Account --output text)" >> "$GITHUB_OUTPUT"
41+
- name: Get API keys from Secrets Manager
42+
uses: aws-actions/aws-secretsmanager-get-secrets@v2
43+
with:
44+
secret-ids: |
45+
E2E,${{ secrets.E2E_SECRET_ARN }}
46+
parse-json-secrets: true
47+
- run: npm ci
48+
- run: npm run build
49+
- name: Run E2E tests
50+
env:
51+
AWS_ACCOUNT_ID: ${{ steps.aws.outputs.account_id }}
52+
AWS_REGION: ${{ inputs.aws_region || 'us-east-1' }}
53+
ANTHROPIC_API_KEY: ${{ env.E2E_ANTHROPIC_API_KEY }}
54+
OPENAI_API_KEY: ${{ env.E2E_OPENAI_API_KEY }}
55+
GEMINI_API_KEY: ${{ env.E2E_GEMINI_API_KEY }}
56+
run: npm run test:e2e

.github/workflows/e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ jobs:
5353
ANTHROPIC_API_KEY: ${{ env.E2E_ANTHROPIC_API_KEY }}
5454
OPENAI_API_KEY: ${{ env.E2E_OPENAI_API_KEY }}
5555
GEMINI_API_KEY: ${{ env.E2E_GEMINI_API_KEY }}
56-
run: npm run test:e2e
56+
run: npx vitest run --project e2e strands-bedrock strands-openai langgraph-bedrock googleadk-gemini

e2e-tests/e2e-helper.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import { hasAwsCredentials, parseJsonOutput, prereqs, runCLI } from '../src/test-utils/index.js';
2+
import {
3+
BedrockAgentCoreControlClient,
4+
DeleteApiKeyCredentialProviderCommand,
5+
} from '@aws-sdk/client-bedrock-agentcore-control';
26
import { execSync } from 'node:child_process';
37
import { randomUUID } from 'node:crypto';
48
import { mkdir, rm, writeFile } from 'node:fs/promises';
@@ -99,6 +103,20 @@ export function createE2ESuite(cfg: E2EConfig) {
99103
console.log('Teardown stdout:', result.stdout);
100104
console.log('Teardown stderr:', result.stderr);
101105
}
106+
107+
// Delete the API key credential provider from the account.
108+
// These are created as a pre-deploy step outside CDK and are not
109+
// cleaned up by stack teardown, so we must delete them explicitly.
110+
if (cfg.modelProvider !== 'Bedrock' && agentName) {
111+
const providerName = `${agentName}${cfg.modelProvider}`;
112+
const region = process.env.AWS_REGION ?? 'us-east-1';
113+
try {
114+
const client = new BedrockAgentCoreControlClient({ region });
115+
await client.send(new DeleteApiKeyCredentialProviderCommand({ name: providerName }));
116+
} catch {
117+
// Best-effort cleanup — don't fail the test if deletion fails
118+
}
119+
}
102120
}
103121
if (testDir) await rm(testDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 1000 });
104122
}, 600000);

0 commit comments

Comments
 (0)