Skip to content

Commit cfba9c9

Browse files
committed
wip
1 parent 5ee2597 commit cfba9c9

File tree

5 files changed

+43
-23
lines changed

5 files changed

+43
-23
lines changed

dev-packages/e2e-tests/test-applications/aws-serverless/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,17 @@
2323
},
2424
"volta": {
2525
"extends": "../../package.json"
26+
},
27+
"sentryTest": {
28+
"variants": [
29+
{
30+
"assert-command": "NODE_VERSION=20 pnpm test:assert",
31+
"label": "aws-serverless (Node 20)"
32+
},
33+
{
34+
"assert-command": "NODE_VERSION=18 pnpm test:assert",
35+
"label": "aws-serverless (Node 18)"
36+
}
37+
]
2638
}
2739
}

dev-packages/e2e-tests/test-applications/aws-serverless/src/lambda-functions-layer/TracingCjs/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ const Sentry = require('@sentry/aws-serverless');
22
const http = require('http');
33

44
exports.handler = async (event, context) => {
5+
console.log(process.version);
6+
console.log('PROCESS VERSION');
57
await Sentry.startSpan({ name: 'manual-span', op: 'test' }, async () => {
68
await new Promise(resolve => {
79
http.get('http://example.com', res => {
810
res.on('data', d => {
9-
process.stdout.write(d);
11+
process.stdout.write(process.version);
1012
});
1113

1214
res.on('end', () => {

dev-packages/e2e-tests/test-applications/aws-serverless/src/lambda-functions-npm/TracingEsm/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ export const handler = Sentry.wrapHandler(async () => {
2020
req.end();
2121
});
2222

23-
Sentry.startSpan({ name: 'manual-span', op: 'manual' }, () => {});
23+
Sentry.startSpan({ name: 'manual-span', op: process.version }, () => {});
2424
});

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

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
1616
async ({}, use) => {
1717
console.log('[testEnvironment fixture] Setting up AWS Lambda test infrastructure');
1818

19+
console.log('NODE_VERSION', process.env.NODE_VERSION);
20+
1921
execSync('docker network prune -f');
2022
execSync(`docker network create --driver bridge ${DOCKER_NETWORK_NAME}`);
2123

@@ -29,23 +31,25 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
2931
const debugLog = tmp.fileSync({ prefix: 'sentry_aws_lambda_tests_sam_debug', postfix: '.log' });
3032
console.log(`[test_environment fixture] Writing SAM debug log to: ${debugLog.name}`);
3133

32-
const process = spawn(
33-
'sam',
34-
[
35-
'local',
36-
'start-lambda',
37-
'--debug',
38-
'--template',
39-
SAM_TEMPLATE_FILE,
40-
'--warm-containers',
41-
'EAGER',
42-
'--docker-network',
43-
DOCKER_NETWORK_NAME,
44-
],
45-
{
46-
stdio: ['ignore', debugLog.fd, debugLog.fd],
47-
},
48-
);
34+
const args = [
35+
'local',
36+
'start-lambda',
37+
'--debug',
38+
'--template',
39+
SAM_TEMPLATE_FILE,
40+
'--warm-containers',
41+
'EAGER',
42+
'--docker-network',
43+
DOCKER_NETWORK_NAME,
44+
];
45+
46+
if (process.env.NODE_VERSION) {
47+
args.push('--invoke-image', `public.ecr.aws/sam/build-nodejs${process.env.NODE_VERSION}.x:latest`);
48+
}
49+
50+
const samProcess = spawn('sam', args, {
51+
stdio: ['ignore', debugLog.fd, debugLog.fd],
52+
});
4953

5054
try {
5155
await LocalLambdaStack.waitForStack();
@@ -54,12 +58,12 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
5458
} finally {
5559
console.log('[testEnvironment fixture] Tearing down AWS Lambda test infrastructure');
5660

57-
process.kill('SIGTERM');
61+
samProcess.kill('SIGTERM');
5862
await new Promise(resolve => {
59-
process.once('exit', resolve);
63+
samProcess.once('exit', resolve);
6064
setTimeout(() => {
61-
if (!process.killed) {
62-
process.kill('SIGKILL');
65+
if (!samProcess.killed) {
66+
samProcess.kill('SIGKILL');
6367
}
6468
resolve(void 0);
6569
}, 5000);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ test.describe('Lambda layer', () => {
4040

4141
expect(transactionEvent.spans).toHaveLength(2);
4242

43+
console.log(transactionEvent.spans);
44+
4345
// shows that the Otel Http instrumentation is working
4446
expect(transactionEvent.spans).toContainEqual(
4547
expect.objectContaining({

0 commit comments

Comments
 (0)