Skip to content

Commit df22788

Browse files
committed
ci: shard e2e full suite across 6 runners
- Add 6-way vitest sharding to the cdk-source matrix (2 → 12 parallel runners) - Isolate import test resources per run via RESOURCE_SUFFIX to prevent concurrent conflicts
1 parent 76b07aa commit df22788

5 files changed

Lines changed: 20 additions & 7 deletions

File tree

.github/workflows/e2e-tests-full.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
cdk-source: [npm, main]
30+
shard: ['1/6', '2/6', '3/6', '4/6', '5/6', '6/6']
3031
steps:
3132
- uses: actions/checkout@v6
3233
with:
@@ -70,15 +71,15 @@ jobs:
7071
CDK_REPO: ${{ secrets.CDK_REPO_NAME }}
7172
- name: Install CLI globally
7273
run: npm install -g "$(npm pack | tail -1)"
73-
- name: Run E2E tests (${{ matrix.cdk-source }})
74+
- name: Run E2E tests (${{ matrix.cdk-source }}, shard ${{ matrix.shard }})
7475
env:
7576
AWS_ACCOUNT_ID: ${{ steps.aws.outputs.account_id }}
7677
AWS_REGION: ${{ inputs.aws_region || 'us-east-1' }}
7778
ANTHROPIC_API_KEY: ${{ env.E2E_ANTHROPIC_API_KEY }}
7879
OPENAI_API_KEY: ${{ env.E2E_OPENAI_API_KEY }}
7980
GEMINI_API_KEY: ${{ env.E2E_GEMINI_API_KEY }}
8081
CDK_TARBALL: ${{ env.CDK_TARBALL }}
81-
run: npm run test:e2e
82+
run: npx vitest run --project e2e --shard=${{ matrix.shard }}
8283
browser-tests:
8384
runs-on: ubuntu-latest
8485
environment: e2e-testing

e2e-tests/fixtures/import/cleanup_resources.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,20 @@ def cleanup_s3_code_objects():
2222
account_id = get_account_id()
2323
bucket_name = f"bugbash-agentcore-code-{account_id}-{REGION}"
2424
s3 = boto3.client("s3", region_name=REGION)
25+
prefix = f"bugbash-{RESOURCE_SUFFIX}/" if RESOURCE_SUFFIX else ""
2526
try:
26-
resp = s3.list_objects_v2(Bucket=bucket_name)
27+
list_args = {"Bucket": bucket_name}
28+
if prefix:
29+
list_args["Prefix"] = prefix
30+
resp = s3.list_objects_v2(**list_args)
2731
objects = resp.get("Contents", [])
2832
if not objects:
2933
return
3034
s3.delete_objects(
3135
Bucket=bucket_name,
3236
Delete={"Objects": [{"Key": o["Key"]} for o in objects]},
3337
)
34-
print(f"Deleted {len(objects)} object(s) from s3://{bucket_name}")
38+
print(f"Deleted {len(objects)} object(s) from s3://{bucket_name}/{prefix}")
3539
except Exception as e:
3640
print(f"Could not clean up S3 objects: {e}")
3741

e2e-tests/fixtures/import/common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
import boto3
99

1010
REGION = os.environ.get("AWS_REGION") or os.environ.get("AWS_DEFAULT_REGION") or "us-east-1"
11+
RESOURCE_SUFFIX = os.environ.get("RESOURCE_SUFFIX", "")
1112
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
1213
APP_DIR = os.path.join(SCRIPT_DIR, "app")
13-
RESOURCES_FILE = os.path.join(SCRIPT_DIR, "bugbash-resources.json")
14+
_resources_name = f"bugbash-resources-{RESOURCE_SUFFIX}.json" if RESOURCE_SUFFIX else "bugbash-resources.json"
15+
RESOURCES_FILE = os.path.join(SCRIPT_DIR, _resources_name)
1416
INLINE_POLICY_NAME = "bugbash-agentcore-permissions"
1517

1618

@@ -35,6 +37,8 @@ def upload_code(prefix="bugbash"):
3537
"""Zip APP_DIR and upload to S3. Returns (bucket, s3_key)."""
3638
bucket_name = get_code_bucket()
3739
s3 = boto3.client("s3", region_name=REGION)
40+
if RESOURCE_SUFFIX:
41+
prefix = f"{prefix}-{RESOURCE_SUFFIX}"
3842

3943
# Create zip of app directory
4044
with tempfile.NamedTemporaryFile(suffix=".zip", delete=False) as tmp:

e2e-tests/import-gateway.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@ describe.sequential('e2e: import gateway', () => {
4343

4444
const result = await spawnAndCollect('uv', ['run', '--with', 'boto3', 'python3', 'setup_gateway.py'], fixtureDir, {
4545
AWS_REGION: region,
46+
RESOURCE_SUFFIX: suffix,
4647
});
4748
if (result.exitCode !== 0) {
4849
throw new Error(
4950
`setup_gateway.py failed (exit ${result.exitCode}):\nstdout: ${result.stdout}\nstderr: ${result.stderr}`
5051
);
5152
}
5253

53-
const resourcesPath = join(fixtureDir, 'bugbash-resources.json');
54+
const resourcesPath = join(fixtureDir, `bugbash-resources-${suffix}.json`);
5455
const resources = JSON.parse(await readFile(resourcesPath, 'utf-8')) as Record<string, { arn: string; id: string }>;
5556
gatewayArn = resources.gateway!.arn;
5657

@@ -80,6 +81,7 @@ describe.sequential('e2e: import gateway', () => {
8081
try {
8182
await spawnAndCollect('uv', ['run', '--with', 'boto3', 'python3', 'cleanup_resources.py'], fixtureDir, {
8283
AWS_REGION: region,
84+
RESOURCE_SUFFIX: suffix,
8385
});
8486
} catch {
8587
/* ignore — resources may already be deleted by CFN teardown */

e2e-tests/import-resources.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ describe.sequential('e2e: import runtime/memory/evaluator', () => {
5454
const result = await spawnAndCollect('uv', ['run', '--with', 'boto3', 'python3', script], fixtureDir, {
5555
AWS_REGION: region,
5656
DEFAULT_EVALUATOR_MODEL,
57+
RESOURCE_SUFFIX: suffix,
5758
});
5859
if (result.exitCode !== 0) {
5960
throw new Error(
@@ -63,7 +64,7 @@ describe.sequential('e2e: import runtime/memory/evaluator', () => {
6364
}
6465

6566
// 2. Read resource ARNs from bugbash-resources.json
66-
const resourcesPath = join(fixtureDir, 'bugbash-resources.json');
67+
const resourcesPath = join(fixtureDir, `bugbash-resources-${suffix}.json`);
6768
const resources = JSON.parse(await readFile(resourcesPath, 'utf-8')) as Record<string, { arn: string; id: string }>;
6869
runtimeArn = resources['runtime-basic']!.arn;
6970
memoryArn = resources['memory-full']!.arn;
@@ -102,6 +103,7 @@ describe.sequential('e2e: import runtime/memory/evaluator', () => {
102103
try {
103104
await spawnAndCollect('uv', ['run', '--with', 'boto3', 'python3', 'cleanup_resources.py'], fixtureDir, {
104105
AWS_REGION: region,
106+
RESOURCE_SUFFIX: suffix,
105107
});
106108
} catch {
107109
/* ignore — resources may already be deleted by CFN teardown */

0 commit comments

Comments
 (0)