Skip to content

Commit a832c47

Browse files
SVLS-8232: Properly test cold_start attribute in LMI
1 parent 2be85c6 commit a832c47

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

integration-tests/tests/lmi.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,22 @@ describe('LMI Integration Tests', () => {
6767
expect(awsLambdaSpan?.attributes.custom.init_type).toBe('lambda-managed-instances')
6868
})
6969
// SVLS-8232
70-
test.skip('aws.lambda.span should have cold_start set to false', () => {
70+
it('aws.lambda.span should have cold_start set to false if no cold_start operation', () => {
7171
const trace = results[runtime].traces![0];
72+
73+
// The presence of 'aws.lambda.cold_start' span indicates a cold start
74+
const coldStartSpan = trace.spans.find((span: any) =>
75+
span.attributes.operation_name === 'aws.lambda.cold_start'
76+
);
77+
7278
const awsLambdaSpan = trace.spans.find((span: any) =>
7379
span.attributes.operation_name === 'aws.lambda'
7480
);
75-
expect(awsLambdaSpan?.attributes.custom.cold_start).toBe('false')
81+
expect(awsLambdaSpan).toBeDefined(); // Ensure span exists before checking attributes
82+
83+
// cold_start attribute should be 'true' if cold_start span exists, 'false' otherwise
84+
const expectedColdStart = coldStartSpan ? 'true' : 'false';
85+
expect(awsLambdaSpan?.attributes.custom.cold_start).toBe(expectedColdStart);
7686
})
7787

7888
});

0 commit comments

Comments
 (0)