Skip to content

Commit

Permalink
Clean up end-to-end tests (#1549)
Browse files Browse the repository at this point in the history
This removes an obsolete test (managed-ng-os-py), it was added before
nodejs and the rest of the SDKs shared the same implementation. This
functionality is already covered by the nodejs based test
(managed-ng-os).

Additionally it changes the e2e tests to place instances in private
subnets in order to reduce the EIP usage (reduces contention and saves
money).
  • Loading branch information
flostadler authored Dec 23, 2024
1 parent ba150d6 commit 5f18b85
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 207 deletions.
15 changes: 0 additions & 15 deletions tests/py_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,6 @@ func TestAccManagedNodeGroupPy(t *testing.T) {
programTestWithExtraOptions(t, &test, nil)
}

func TestAccManagedNodeGroupOSPy(t *testing.T) {
test := getPythonBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: path.Join(getTestPrograms(t), "managed-ng-os-py"),
ExtraRuntimeValidation: func(t *testing.T, info integration.RuntimeValidationStackInfo) {
utils.ValidateClusters(t, info.Deployment.Resources, utils.WithKubeConfigs(info.Outputs["kubeconfig"]))

// expect 4 nodes with increased pod capacity of 100
assert.NoError(t, utils.ValidateNodePodCapacity(t, info.Outputs["kubeconfig"], 4, 100, "increased-pod-capacity"))
},
})

programTestWithExtraOptions(t, &test, nil)
}

func getPythonBaseOptions(t *testing.T) integration.ProgramTestOptions {
region := getEnvRegion(t)
base := getBaseOptions(t)
Expand Down
1 change: 1 addition & 0 deletions tests/testdata/programs/cluster-addons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ const ng = eks.createManagedNodeGroup("cluster-addons", {
// need instances that support ENI trunking to support SGs for pods: https://docs.aws.amazon.com/eks/latest/userguide/security-groups-for-pods.html
instanceTypes: ["c6i.large"],
nodeRole: role,
subnetIds: eksVpc.privateSubnetIds,
});
1 change: 1 addition & 0 deletions tests/testdata/programs/cluster-addons/step2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ const ng = eks.createManagedNodeGroup("cluster-addons", {
// need instances that support ENI trunking to support SGs for pods: https://docs.aws.amazon.com/eks/latest/userguide/security-groups-for-pods.html
instanceTypes: ["c6i.large"],
nodeRole: role,
subnetIds: eksVpc.privateSubnetIds,
});
1 change: 1 addition & 0 deletions tests/testdata/programs/ignore-scaling-changes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ const ngV2 = new eks.NodeGroupV2("ignore-scaling-config-ngv2", {
operatingSystem: eks.OperatingSystem.AL2023,
instanceProfile: new aws.iam.InstanceProfile("ignore-scaling-config-ngv2", {role: ngV2Role}),
ignoreScalingChanges: true,
subnetIds: eksVpc.privateSubnetIds,
});
1 change: 1 addition & 0 deletions tests/testdata/programs/managed-ng-disk-size/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ eks.createManagedNodeGroup(`${projectName}-managed-ng`, {
// Force creating a custom launch template
kubeletExtraArgs: "--max-pods=500",
diskSize: 50,
subnetIds: eksVpc.privateSubnetIds,
});
3 changes: 0 additions & 3 deletions tests/testdata/programs/managed-ng-os-py/Pulumi.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions tests/testdata/programs/managed-ng-os-py/README.md

This file was deleted.

116 changes: 0 additions & 116 deletions tests/testdata/programs/managed-ng-os-py/__main__.py

This file was deleted.

32 changes: 0 additions & 32 deletions tests/testdata/programs/managed-ng-os-py/iam.py

This file was deleted.

4 changes: 0 additions & 4 deletions tests/testdata/programs/managed-ng-os-py/requirements.txt

This file was deleted.

35 changes: 18 additions & 17 deletions tests/testdata/programs/managed-ng-os/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const eksVpc = new awsx.ec2.Vpc("managed-ng-os", {
const cluster = new eks.Cluster("managed-ng-os", {
skipDefaultNodeGroup: true,
vpcId: eksVpc.vpcId,
authenticationMode: eks.AuthenticationMode.API,
authenticationMode: eks.AuthenticationMode.Api,
// Public subnets will be used for load balancers
publicSubnetIds: eksVpc.publicSubnetIds,
// Private subnets will be used for cluster nodes
Expand All @@ -36,19 +36,20 @@ const cluster = new eks.Cluster("managed-ng-os", {
// Export the cluster's kubeconfig.
export const kubeconfig = cluster.kubeconfig;

const scalingConfig = {
const baseConfig = {
scalingConfig: {
minSize: 1,
maxSize: 1,
desiredSize: 1,
},
subnetIds: eksVpc.privateSubnetIds,
}

const increasedPodCapacity = 100;

// Create a simple AL 2023 node group with x64 instances
const managedNodeGroupAL2023 = eks.createManagedNodeGroup("al-2023-mng", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.AL2023,
instanceTypes: ["t3.medium"],
Expand All @@ -57,7 +58,7 @@ const managedNodeGroupAL2023 = eks.createManagedNodeGroup("al-2023-mng", {

// Create a node group with a launch template and custom AMI
const managedNodeGroup = new eks.ManagedNodeGroup("al-2023-mng-amitype-launch-template", {
...scalingConfig,
...baseConfig,
cluster: cluster,
nodeRole: role,
amiType: "AL2023_ARM_64_STANDARD",
Expand All @@ -66,7 +67,7 @@ const managedNodeGroup = new eks.ManagedNodeGroup("al-2023-mng-amitype-launch-te
});

const managedNodeGroupAL2023Taints = eks.createManagedNodeGroup("al-2023-mng-taints", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.AL2023,
instanceTypes: ["t3.medium"],
Expand All @@ -91,7 +92,7 @@ const managedNodeGroupAL2023Taints = eks.createManagedNodeGroup("al-2023-mng-tai

// Create a simple AL 2023 node group with arm instances
const managedNodeGroupAL2023Arm = eks.createManagedNodeGroup("al-2023-arm-mng", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.AL2023,
instanceTypes: ["t4g.medium"],
Expand All @@ -100,7 +101,7 @@ const managedNodeGroupAL2023Arm = eks.createManagedNodeGroup("al-2023-arm-mng",

// Create an AL 2023 node group with x64 instances and custom user data
const managedNodeGroupAL2023UserData = eks.createManagedNodeGroup("al-2023-mng-userdata", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.AL2023,
instanceTypes: ["t3.medium"],
Expand All @@ -115,7 +116,7 @@ const managedNodeGroupAL2023UserData = eks.createManagedNodeGroup("al-2023-mng-u

// Create an AL 2023 node group with arm instances and custom user data
const managedNodeGroupAL2023ArmUserData = eks.createManagedNodeGroup("al-2023-arm-mng-userdata", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.AL2023,
instanceTypes: ["t4g.medium"],
Expand All @@ -129,7 +130,7 @@ const managedNodeGroupAL2023ArmUserData = eks.createManagedNodeGroup("al-2023-ar
});

const managedNodeGroupAL2023NvidiaGpu = eks.createManagedNodeGroup("al-2023-mng-nvidia-gpu", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.AL2023,
instanceTypes: ["g4dn.xlarge"],
Expand Down Expand Up @@ -207,7 +208,7 @@ const nvidiaDevicePlugin = new k8s.apps.v1.DaemonSet("nvidia-device-plugin", {

// Create a simple Bottlerocket node group with x64 instances
const managedNodeGroupBottlerocket = eks.createManagedNodeGroup("bottlerocket-mng", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.Bottlerocket,
instanceTypes: ["t3.medium"],
Expand All @@ -216,7 +217,7 @@ const managedNodeGroupBottlerocket = eks.createManagedNodeGroup("bottlerocket-mn

// Create a Bottlerocket node group with GPU support (it's the cheapest GPU instance type)
const managedNodeGroupBottlerocketGpu = eks.createManagedNodeGroup("bottlerocket-mng-gpu", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.Bottlerocket,
instanceTypes: ["g5g.xlarge"],
Expand All @@ -226,7 +227,7 @@ const managedNodeGroupBottlerocketGpu = eks.createManagedNodeGroup("bottlerocket

// Create a simple Bottlerocket node group with arm instances
const managedNodeGroupBottlerocketArm = eks.createManagedNodeGroup("bottlerocket-arm-mng", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.Bottlerocket,
instanceTypes: ["t4g.medium"],
Expand All @@ -235,7 +236,7 @@ const managedNodeGroupBottlerocketArm = eks.createManagedNodeGroup("bottlerocket

// Create a Bottlerocket node group with x64 instances and custom user data
const managedNodeGroupBottlerocketUserData = eks.createManagedNodeGroup("bottlerocket-mng-userdata", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.Bottlerocket,
instanceTypes: ["t3.medium"],
Expand All @@ -256,7 +257,7 @@ const managedNodeGroupBottlerocketUserData = eks.createManagedNodeGroup("bottler

// Create a Bottlerocket node group with arm instances and custom user data
const managedNodeGroupBottlerocketArmUserData = eks.createManagedNodeGroup("bottlerocket-arm-mng-userdata", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.Bottlerocket,
instanceTypes: ["t4g.medium"],
Expand All @@ -276,7 +277,7 @@ const managedNodeGroupBottlerocketArmUserData = eks.createManagedNodeGroup("bott
});

const managedNodeGroupBottlerocketTaints = eks.createManagedNodeGroup("bottlerocket-mng-taints", {
...scalingConfig,
...baseConfig,
cluster: cluster,
operatingSystem: eks.OperatingSystem.Bottlerocket,
instanceTypes: ["t3.medium"],
Expand Down Expand Up @@ -318,7 +319,7 @@ const customUserData = userdata.createUserData({
}, `--max-pods=${increasedPodCapacity} --node-labels=increased-pod-capacity=true`);

const managedNodeGroupAL2023CustomUserData = eks.createManagedNodeGroup("al-2023-mng-custom-userdata", {
...scalingConfig,
...baseConfig,
operatingSystem: eks.OperatingSystem.AL2023,
cluster: cluster,
instanceTypes: ["t3.medium"],
Expand All @@ -329,7 +330,7 @@ const managedNodeGroupAL2023CustomUserData = eks.createManagedNodeGroup("al-2023
});

const managedNodeGroupAL2023NodeadmExtraOptions = eks.createManagedNodeGroup("al-2023-mng-extra-options", {
...scalingConfig,
...baseConfig,
operatingSystem: eks.OperatingSystem.AL2023,
cluster: cluster,
instanceTypes: ["t3.medium"],
Expand Down
3 changes: 3 additions & 0 deletions tests/testdata/programs/managed-ng-with-version/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const managedNodeGroup0 = eks.createManagedNodeGroup("example-managed-ng0", {
kubeletExtraArgs: "--max-pods=500",
enableIMDSv2: true,
version: cluster.eksCluster.version,
subnetIds: eksVpc.privateSubnetIds,
}, cluster);

// Simple managed node group
Expand All @@ -42,6 +43,7 @@ const managedNodeGroup1 = eks.createManagedNodeGroup("example-managed-ng1", {
nodeGroupName: "aws-managed-ng1",
nodeRoleArn: role1.arn,
version: cluster.eksCluster.version,
subnetIds: eksVpc.privateSubnetIds,
}, cluster);

// Managed node group with IMDSv2 enabled
Expand All @@ -50,4 +52,5 @@ const managedNodeGroup2 = eks.createManagedNodeGroup("example-managed-ng2", {
nodeRole: role2,
version: cluster.eksCluster.version,
enableIMDSv2: true,
subnetIds: eksVpc.privateSubnetIds,
}, cluster);
Loading

0 comments on commit 5f18b85

Please sign in to comment.