Skip to content

Commit 5d9e1bb

Browse files
authored
test(aws): Improve reliability on CI (#17502)
- Speed up AWS E2E tests on CI by pulling a smaller Lambda image and not re-pulling it on Lambda startup. - Write SAM logs to stdout on CI instead of a temp file to help debugging.
1 parent 1854214 commit 5d9e1bb

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Script to pull the correct SAM docker image based on the NODE_VERSION environment variable.
3+
# Script to pull the correct Lambda docker image based on the NODE_VERSION environment variable.
44

55
set -e
66

@@ -9,7 +9,7 @@ if [[ -z "$NODE_VERSION" ]]; then
99
exit 1
1010
fi
1111

12-
echo "Pulling SAM Node $NODE_VERSION docker image..."
13-
docker pull "public.ecr.aws/sam/build-nodejs${NODE_VERSION}.x:latest"
12+
echo "Pulling Lambda Node $NODE_VERSION docker image..."
13+
docker pull "public.ecr.aws/lambda/nodejs:${NODE_VERSION}"
1414

15-
echo "Successfully pulled SAM Node $NODE_VERSION docker image"
15+
echo "Successfully pulled Lambda Node $NODE_VERSION docker image"

dev-packages/e2e-tests/test-applications/aws-serverless/tests/lambda-fixtures.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
2727
writeFileSync(SAM_TEMPLATE_FILE, JSON.stringify(template, null, 2));
2828

2929
const debugLog = tmp.fileSync({ prefix: 'sentry_aws_lambda_tests_sam_debug', postfix: '.log' });
30-
console.log(`[test_environment fixture] Writing SAM debug log to: ${debugLog.name}`);
30+
if (!process.env.CI) {
31+
console.log(`[test_environment fixture] Writing SAM debug log to: ${debugLog.name}`);
32+
}
3133

3234
const args = [
3335
'local',
@@ -39,16 +41,17 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
3941
'EAGER',
4042
'--docker-network',
4143
DOCKER_NETWORK_NAME,
44+
'--skip-pull-image',
4245
];
4346

4447
if (process.env.NODE_VERSION) {
45-
args.push('--invoke-image', `public.ecr.aws/sam/build-nodejs${process.env.NODE_VERSION}.x:latest`);
48+
args.push('--invoke-image', `public.ecr.aws/lambda/nodejs:${process.env.NODE_VERSION}`);
4649
}
4750

4851
console.log(`[testEnvironment fixture] Running SAM with args: ${args.join(' ')}`);
4952

5053
const samProcess = spawn('sam', args, {
51-
stdio: ['ignore', debugLog.fd, debugLog.fd],
54+
stdio: process.env.CI ? 'inherit' : ['ignore', debugLog.fd, debugLog.fd],
5255
});
5356

5457
try {

0 commit comments

Comments
 (0)