Skip to content

Commit 53f6b21

Browse files
committed
Consolidate two mhc tests into one
1 parent d0cb679 commit 53f6b21

File tree

6 files changed

+42
-47
lines changed

6 files changed

+42
-47
lines changed

test/e2e/config/cloudstack.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ providers:
8484
- sourcePath: "../data/infrastructure-cloudstack/v1beta1/cluster-template-insufficient-compute-resources.yaml"
8585
- sourcePath: "../data/infrastructure-cloudstack/v1beta1/cluster-template-invalid-worker-offering.yaml"
8686
- sourcePath: "../data/infrastructure-cloudstack/v1beta1/cluster-template-node-drain.yaml"
87-
- sourcePath: "../data/infrastructure-cloudstack/v1beta1/cluster-template-destroy-kcp-machine.yaml"
88-
- sourcePath: "../data/infrastructure-cloudstack/v1beta1/cluster-template-destroy-md-machine.yaml"
87+
- sourcePath: "../data/infrastructure-cloudstack/v1beta1/cluster-template-destroy-machine.yaml"
8988
- sourcePath: "../data/shared/v1beta1/metadata.yaml"
9089
versions:
9190
- name: v1.0.0
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: MachineHealthCheck
4+
metadata:
5+
name: "${CLUSTER_NAME}-mhc-md-0"
6+
spec:
7+
clusterName: "${CLUSTER_NAME}"
8+
maxUnhealthy: 100%
9+
selector:
10+
matchLabels:
11+
e2e.mhc.label: ""
12+
unhealthyConditions:
13+
- type: Ready
14+
status: Unknown
15+
timeout: 60s
16+
- type: Ready
17+
status: "False"
18+
timeout: 60s
19+
---
20+
apiVersion: cluster.x-k8s.io/v1beta1
21+
kind: MachineHealthCheck
22+
metadata:
23+
name: "${CLUSTER_NAME}-mhc-kcp-0"
24+
spec:
25+
clusterName: "${CLUSTER_NAME}"
26+
maxUnhealthy: 100%
27+
selector:
28+
matchLabels:
29+
cluster.x-k8s.io/control-plane: ""
30+
unhealthyConditions:
31+
- type: Ready
32+
status: Unknown
33+
timeout: 60s
34+
- type: Ready
35+
status: "False"
36+
timeout: 60s

test/e2e/data/infrastructure-cloudstack/v1beta1/cluster-template-destroy-md-machine/mhc.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/e2e/destroy_machine.go

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func DestroyMachineSpec(ctx context.Context, inputGetter func() CommonSpecInput)
5656
clusterResources = new(clusterctl.ApplyClusterTemplateAndWaitResult)
5757
})
5858

59-
It("Should replace a KCP machine when it is destroyed", func() {
59+
It("Should replace a machine when it is destroyed", func() {
6060
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
6161
ClusterProxy: input.BootstrapClusterProxy,
6262
CNIManifestPath: input.E2EConfig.GetVariable(CNIPath),
@@ -65,44 +65,22 @@ func DestroyMachineSpec(ctx context.Context, inputGetter func() CommonSpecInput)
6565
ClusterctlConfigPath: input.ClusterctlConfigPath,
6666
KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(),
6767
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
68-
Flavor: "destroy-kcp-machine",
68+
Flavor: "destroy-machine",
6969
Namespace: namespace.Name,
7070
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),
7171
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
7272
ControlPlaneMachineCount: pointer.Int64Ptr(3),
73-
WorkerMachineCount: pointer.Int64Ptr(1),
73+
WorkerMachineCount: pointer.Int64Ptr(3),
7474
},
7575
WaitForClusterIntervals: input.E2EConfig.GetIntervals(specName, "wait-cluster"),
7676
WaitForControlPlaneIntervals: input.E2EConfig.GetIntervals(specName, "wait-control-plane"),
7777
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
7878
}, clusterResources)
7979

80+
By("Testing control plane remediation")
8081
DestroyOneMachineAndWaitForReplacement(clusterResources.Cluster.Name, "control-plane", input.E2EConfig.GetIntervals(specName, "wait-machine-remediation"))
8182

82-
By("PASSED!")
83-
})
84-
85-
It("Should replace a machine deployment when it is destroyed", func() {
86-
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
87-
ClusterProxy: input.BootstrapClusterProxy,
88-
CNIManifestPath: input.E2EConfig.GetVariable(CNIPath),
89-
ConfigCluster: clusterctl.ConfigClusterInput{
90-
LogFolder: filepath.Join(input.ArtifactFolder, "clusters", input.BootstrapClusterProxy.GetName()),
91-
ClusterctlConfigPath: input.ClusterctlConfigPath,
92-
KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(),
93-
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
94-
Flavor: "destroy-md-machine",
95-
Namespace: namespace.Name,
96-
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),
97-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
98-
ControlPlaneMachineCount: pointer.Int64Ptr(1),
99-
WorkerMachineCount: pointer.Int64Ptr(3),
100-
},
101-
WaitForClusterIntervals: input.E2EConfig.GetIntervals(specName, "wait-cluster"),
102-
WaitForControlPlaneIntervals: input.E2EConfig.GetIntervals(specName, "wait-control-plane"),
103-
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
104-
}, clusterResources)
105-
83+
By("Testing machine deployment remediation")
10684
DestroyOneMachineAndWaitForReplacement(clusterResources.Cluster.Name, "md", input.E2EConfig.GetIntervals(specName, "wait-machine-remediation"))
10785

10886
By("PASSED!")

0 commit comments

Comments
 (0)