Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab/datasources/test-suites.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_suites:
- name: base
- name: on-demand
- name: otlp
- name: snapstart
- name: lmi
4 changes: 2 additions & 2 deletions integration-tests/bin/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import {Base} from '../lib/stacks/base';
import {OnDemand} from '../lib/stacks/on-demand';
import {Otlp} from '../lib/stacks/otlp';
import {Snapstart} from '../lib/stacks/snapstart';
import {LambdaManagedInstancesStack} from '../lib/stacks/lmi';
Expand All @@ -22,7 +22,7 @@ const identifier = getIdentifier();
new CapacityProviderStack(app, `integ-default-capacity-provider`, {env});

const stacks = [
new Base(app, `integ-${identifier}-base`, {
new OnDemand(app, `integ-${identifier}-on-demand`, {
env,
}),
new Otlp(app, `integ-${identifier}-otlp`, {
Expand Down
9 changes: 9 additions & 0 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import * as os from 'os';
export const ACCOUNT = process.env.CDK_DEFAULT_ACCOUNT || process.env.AWS_ACCOUNT_ID;
export const REGION = process.env.CDK_DEFAULT_REGION || process.env.AWS_REGION || 'us-east-1';

// Default wait time for Datadog to index logs and traces after Lambda invocation
export const DEFAULT_DATADOG_INDEXING_WAIT_MS = 5 * 60 * 1000; // 5 minutes

// Extended wait time for async invocations (SQS, SNS) - need more time for message processing
export const ASYNC_DATADOG_INDEXING_WAIT_MS = 90 * 1000; // 90 seconds

// Extended wait time for tests that need more time (e.g., OTLP tests)
export const DATADOG_INDEXING_WAIT_5_MIN_MS = 5 * 60 * 1000; // 5 minutes
Comment on lines +10 to +13


export function getIdentifier(): string {
if (process.env.IDENTIFIER) {
Expand Down
19 changes: 0 additions & 19 deletions integration-tests/lambda/base-dotnet/Function.cs

This file was deleted.

5 changes: 0 additions & 5 deletions integration-tests/lambda/base-java/.gitignore

This file was deleted.

50 changes: 0 additions & 50 deletions integration-tests/lambda/base-java/pom.xml

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions integration-tests/lambda/base-node/index.js

This file was deleted.

9 changes: 0 additions & 9 deletions integration-tests/lambda/base-node/package.json

This file was deleted.

10 changes: 0 additions & 10 deletions integration-tests/lambda/base-python/lambda_function.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
bin/
obj/
*.user
*.suo
37 changes: 37 additions & 0 deletions integration-tests/lambda/default-dotnet/Function.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Amazon.Lambda.Core;
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading;

[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]

namespace Function
{
public class Handler
{
public Dictionary<string, object> FunctionHandler(JsonElement input, ILambdaContext context)
{
context.Logger.LogLine("Hello world!");

var sleepMsStr = Environment.GetEnvironmentVariable("SLEEP_MS");
if (!string.IsNullOrEmpty(sleepMsStr) && int.TryParse(sleepMsStr, out int sleepMs) && sleepMs > 0)
{
context.Logger.LogLine($"Sleeping for {sleepMs}ms");
Thread.Sleep(sleepMs);
}

var body = new Dictionary<string, object>
{
{ "message", "Success" },
{ "requestId", context.AwsRequestId }
};

return new Dictionary<string, object>
{
{ "statusCode", 200 },
{ "body", JsonSerializer.Serialize(body) }
};
}
}
}
4 changes: 4 additions & 0 deletions integration-tests/lambda/default-java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target/
*.class
*.jar
!function.jar
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
<modelVersion>4.0.0</modelVersion>

<groupId>example</groupId>
<artifactId>managed-instances-java-lambda</artifactId>
<artifactId>java-lambda</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>Managed Instances Java Lambda</name>
<name>Java Lambda</name>
<description>Shared Java Lambda function for Datadog Extension integration testing</description>

<properties>
<maven.compiler.source>21</maven.compiler.source>
Expand All @@ -23,6 +24,11 @@
<artifactId>aws-lambda-java-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.15.2</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package example;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.Map;

public class Handler implements RequestHandler<Map<String, Object>, Map<String, Object>> {

private static final ObjectMapper objectMapper = new ObjectMapper();

@Override
public Map<String, Object> handleRequest(Map<String, Object> event, Context context) {
context.getLogger().log("Hello world!");

String sleepMsStr = System.getenv("SLEEP_MS");
if (sleepMsStr != null && !sleepMsStr.isEmpty()) {
try {
int sleepMs = Integer.parseInt(sleepMsStr);
if (sleepMs > 0) {
context.getLogger().log("Sleeping for " + sleepMs + "ms");
Thread.sleep(sleepMs);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (NumberFormatException e) {
context.getLogger().log("Invalid SLEEP_MS value: " + sleepMsStr);
}
}

Map<String, Object> body = new HashMap<>();
body.put("message", "Success");
body.put("requestId", context.getAwsRequestId());

Map<String, Object> response = new HashMap<>();
response.put("statusCode", 200);
try {
response.put("body", objectMapper.writeValueAsString(body));
} catch (Exception e) {
response.put("body", "{}");
}

return response;
}
}
17 changes: 17 additions & 0 deletions integration-tests/lambda/default-node/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
exports.handler = async (event, context) => {
console.log('Hello world!');

const sleepMs = parseInt(process.env.SLEEP_MS || '0', 10);
if (sleepMs > 0) {
console.log(`Sleeping for ${sleepMs}ms`);
await new Promise(resolve => setTimeout(resolve, sleepMs));
}

return {
statusCode: 200,
body: JSON.stringify({
message: 'Success',
requestId: context.awsRequestId
})
};
};
9 changes: 9 additions & 0 deletions integration-tests/lambda/default-node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "integration-test-lambda",
"version": "1.0.0",
"description": "Shared Lambda function for Datadog extension integration testing",
"main": "index.js",
"scripts": {
"clean": "rm -rf node_modules package-lock.json"
}
}
24 changes: 24 additions & 0 deletions integration-tests/lambda/default-python/lambda_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import json
import logging
import os
import time

logger = logging.getLogger()
logger.setLevel(logging.INFO)


def handler(event, context):
logger.info('Hello world!')

sleep_ms = int(os.environ.get('SLEEP_MS', '0'))
if sleep_ms > 0:
logger.info(f'Sleeping for {sleep_ms}ms')
time.sleep(sleep_ms / 1000)

return {
'statusCode': 200,
'body': json.dumps({
'message': 'Success',
'requestId': context.aws_request_id
})
}
20 changes: 0 additions & 20 deletions integration-tests/lambda/lmi-dotnet/Function.cs

This file was deleted.

14 changes: 0 additions & 14 deletions integration-tests/lambda/lmi-dotnet/Function.csproj

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions integration-tests/lambda/lmi-node/index.js

This file was deleted.

Loading
Loading