forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.ts
29 lines (23 loc) · 913 Bytes
/
util.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
import * as ec2 from '@aws-cdk/aws-ec2';
import { App, Stack } from '@aws-cdk/core';
import { Cluster, ClusterProps, KubernetesVersion } from '../lib';
const CLUSTER_VERSION = KubernetesVersion.V1_25;
export function testFixture() {
const { stack, app } = testFixtureNoVpc();
const vpc = new ec2.Vpc(stack, 'VPC');
return { stack, vpc, app };
}
export function testFixtureNoVpc() {
const app = new App();
const stack = new Stack(app, 'Stack', { env: { region: 'us-east-1' } });
return { stack, app };
}
export function testFixtureCluster(props: Omit<ClusterProps, 'version'> = {}) {
const { stack, app } = testFixtureNoVpc();
const cluster = new Cluster(stack, 'Cluster', {
version: CLUSTER_VERSION,
prune: false, // mainly because this feature was added later and we wanted to avoid having to update all test expectations....
...props,
});
return { stack, app, cluster };
}