-
Notifications
You must be signed in to change notification settings - Fork 0
/
ts_test_runner.ts
69 lines (60 loc) · 1.92 KB
/
ts_test_runner.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright 2024 Amazon.com, Inc. or its affiliates.
*/
import { Duration, RemovalPolicy } from "aws-cdk-lib";
import { IRole } from "aws-cdk-lib/aws-iam";
import { DockerImageCode, DockerImageFunction } from "aws-cdk-lib/aws-lambda";
import { Construct } from "constructs";
import { OSMLAccount } from "../../osml_account";
import { OSMLVpc } from "../../osml_vpc";
/**
* Interface representing the properties for the TSTestRunner construct.
*/
export interface TSTestRunnerProps {
/**
* The OSML deployment account.
*/
account: OSMLAccount;
/**
* The OSML vpc to deploy into
*/
osmlVpc: OSMLVpc;
/**
* The Docker image code to use for the lambda function
*/
dockerImageCode: DockerImageCode;
/**
* Optional task role to be used by the TSTestContainer.
*/
taskRole?: IRole;
}
/**
* Represents a construct responsible for deploying an ECR container image
* for the tile server test.
*/
export class TSTestRunner extends Construct {
public removalPolicy: RemovalPolicy;
public lambdaIntegRunner: DockerImageFunction;
/**
* Creates an instance of TSTestRunner.
* @param {Construct} scope - The scope/stack in which to define this construct.
* @param {string} id - The id of this construct within the current scope.
* @param {TSTestRunnerProps} props - The properties of this construct.
* @returns TSTestRunner - The TSTestContainer instance.
*/
constructor(scope: Construct, id: string, props: TSTestRunnerProps) {
super(scope, id);
// Set the removal policy based on the provided properties
this.removalPolicy = props.account.prodLike
? RemovalPolicy.RETAIN
: RemovalPolicy.DESTROY;
this.lambdaIntegRunner = new DockerImageFunction(this, "TSTestRunner", {
code: props.dockerImageCode,
vpc: props.osmlVpc.vpc,
role: props.taskRole,
timeout: Duration.minutes(10),
memorySize: 1024,
functionName: "TSTestRunner"
});
}
}