Skip to content

Commit 9db41e6

Browse files
committed
chore: added e2e tests with DynamoDB Table
1 parent e2b36c8 commit 9db41e6

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

Diff for: packages/tracing/tests/e2e/tracer.test.Decorator.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ export class MyFunctionWithDecorator {
4545
let dynamoDBv2;
4646
refreshAWSSDKImport();
4747
if (event.sdkV2 === 'client') {
48-
dynamoDBv2 = tracer.captureAWSClient(new AWS.Dynamodb.DocumentClient());
48+
dynamoDBv2 = tracer.captureAWSClient(new AWS.DynamoDB.DocumentClient());
4949
} else if (event.sdkV2 === 'all') {
5050
AWS = tracer.captureAWS(AWS);
51-
dynamoDBv2 = new AWS.Dynamodb.DocumentClient();
51+
dynamoDBv2 = new AWS.DynamoDB.DocumentClient();
5252
}
5353

5454
return Promise.all([

Diff for: packages/tracing/tests/e2e/tracer.test.DecoratorWithAsyncHandler.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ export class MyFunctionWithDecorator {
4545
let dynamoDBv2;
4646
refreshAWSSDKImport();
4747
if (event.sdkV2 === 'client') {
48-
dynamoDBv2 = tracer.captureAWSClient(new AWS.Dynamodb.DocumentClient());
48+
dynamoDBv2 = tracer.captureAWSClient(new AWS.DynamoDB.DocumentClient());
4949
} else if (event.sdkV2 === 'all') {
5050
AWS = tracer.captureAWS(AWS);
51-
dynamoDBv2 = new AWS.Dynamodb.DocumentClient();
51+
dynamoDBv2 = new AWS.DynamoDB.DocumentClient();
5252
}
5353

5454
try {

Diff for: packages/tracing/tests/e2e/tracer.test.Manual.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ export const handler = async (event: CustomEvent, _context: Context): Promise<vo
4949
let dynamoDBv2;
5050
refreshAWSSDKImport();
5151
if (event.sdkV2 === 'client') {
52-
dynamoDBv2 = tracer.captureAWSClient(new AWS.Dynamodb.DocumentClient());
52+
dynamoDBv2 = tracer.captureAWSClient(new AWS.DynamoDB.DocumentClient());
5353
} else if (event.sdkV2 === 'all') {
5454
AWS = tracer.captureAWS(AWS);
55-
dynamoDBv2 = new AWS.Dynamodb.DocumentClient();
55+
dynamoDBv2 = new AWS.DynamoDB.DocumentClient();
5656
}
5757
try {
5858
await dynamoDBv2.scan({ TableName: testTableName }).promise();

Diff for: packages/tracing/tests/e2e/tracer.test.Middleware.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ export const handler = middy(async (event: CustomEvent, _context: Context): Prom
4343
let dynamoDBv2;
4444
refreshAWSSDKImport();
4545
if (event.sdkV2 === 'client') {
46-
dynamoDBv2 = tracer.captureAWSClient(new AWS.Dynamodb.DocumentClient());
46+
dynamoDBv2 = tracer.captureAWSClient(new AWS.DynamoDB.DocumentClient());
4747
} else if (event.sdkV2 === 'all') {
4848
AWS = tracer.captureAWS(AWS);
49-
dynamoDBv2 = new AWS.Dynamodb.DocumentClient();
49+
dynamoDBv2 = new AWS.DynamoDB.DocumentClient();
5050
}
5151
try {
5252
await dynamoDBv2.scan({ TableName: testTableName }).promise();

Diff for: packages/tracing/tests/e2e/tracer.test.ts

+13-11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const xray = new AWS.XRay();
2020
const lambdaClient = new AWS.Lambda();
2121
const stsClient = new AWS.STS();
2222

23+
const ONE_MINUTE = 1000 * 60;
24+
2325
describe('Tracer integration tests', () => {
2426

2527
const expectedCustomAnnotationKey = 'myAnnotation';
@@ -123,9 +125,9 @@ describe('Tracer integration tests', () => {
123125
});
124126

125127
// sleep to allow for traces to be collected
126-
await new Promise((resolve) => setTimeout(resolve, 180000));
128+
await new Promise((resolve) => setTimeout(resolve, ONE_MINUTE * 2));
127129

128-
}, 360000); // 6 minutes
130+
}, ONE_MINUTE * 5);
129131

130132
afterAll(async () => {
131133

@@ -143,7 +145,7 @@ describe('Tracer integration tests', () => {
143145
});
144146
}
145147

146-
}, 180000); // 3 minutes
148+
}, ONE_MINUTE * 2);
147149

148150
it('Verifies that a when Tracer is used to manually instrument a function all custom traces are generated with correct annotations and metadata', async () => {
149151

@@ -213,7 +215,7 @@ describe('Tracer integration tests', () => {
213215
}
214216
}
215217

216-
}, 120000); // 2 minutes
218+
}, ONE_MINUTE * 2);
217219

218220
it('Verifies that a when Tracer is used as middleware all custom traces are generated with correct annotations and metadata', async () => {
219221

@@ -283,7 +285,7 @@ describe('Tracer integration tests', () => {
283285
}
284286
}
285287

286-
}, 120000); // 2 minutes
288+
}, ONE_MINUTE * 2);
287289

288290
it('Verifies that a when Tracer is used as middleware, with errors & response capturing disabled, all custom traces are generated with correct annotations', async () => {
289291

@@ -352,7 +354,7 @@ describe('Tracer integration tests', () => {
352354
}
353355
}
354356

355-
}, 120000); // 2 minutes
357+
}, ONE_MINUTE * 2);
356358

357359
it('Verifies that a when tracing is disabled in middleware mode no custom traces are generated', async () => {
358360

@@ -376,7 +378,7 @@ describe('Tracer integration tests', () => {
376378
}
377379
}
378380

379-
}, 120000); // 2 minutes
381+
}, ONE_MINUTE * 2);
380382

381383
it('Verifies that a when Tracer is used as decorator all custom traces are generated with correct annotations and metadata', async () => {
382384

@@ -473,7 +475,7 @@ describe('Tracer integration tests', () => {
473475
}
474476
}
475477

476-
}, 120000); // 2 minutes
478+
}, ONE_MINUTE * 2);
477479

478480
it('Verifies that a when Tracer is used as decorator on an async handler all custom traces are generated with correct annotations and metadata', async () => {
479481

@@ -570,7 +572,7 @@ describe('Tracer integration tests', () => {
570572
}
571573
}
572574

573-
}, 120000); // 2 minutes
575+
}, ONE_MINUTE * 2);
574576

575577
it('Verifies that a when Tracer is used as decorator, with errors & response capturing disabled, all custom traces are generated with correct annotations', async () => {
576578

@@ -656,7 +658,7 @@ describe('Tracer integration tests', () => {
656658
}
657659
}
658660

659-
}, 120000); // 2 minutes
661+
}, ONE_MINUTE * 2);
660662

661663
it('Verifies that a when tracing is disabled in decorator mode no custom traces are generated', async () => {
662664

@@ -680,6 +682,6 @@ describe('Tracer integration tests', () => {
680682
}
681683
}
682684

683-
}, 120000); // 2 minutes
685+
}, ONE_MINUTE * 2);
684686

685687
});

0 commit comments

Comments
 (0)