Skip to content

Commit 3dd7f30

Browse files
authored
Merge pull request #7596 from sbueringer/pr-imprpove-MD-reconciler-test
🌱 MD reconciler: improve integration test
2 parents d84af40 + ea2769f commit 3dd7f30

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

internal/controllers/machinedeployment/machinedeployment_controller_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ func TestMachineDeploymentReconciler(t *testing.T) {
9292
Replicas: pointer.Int32(2),
9393
RevisionHistoryLimit: pointer.Int32(0),
9494
Selector: metav1.LabelSelector{
95-
MatchLabels: map[string]string{
96-
clusterv1.ClusterLabelName: testCluster.Name,
97-
},
95+
// We're using the same labels for spec.selector and spec.template.labels.
96+
// The labels are later changed and we will use the initial labels later to
97+
// verify that all original MachineSets have been deleted.
98+
MatchLabels: labels,
9899
},
99100
Strategy: &clusterv1.MachineDeploymentStrategy{
100101
Type: clusterv1.RollingUpdateMachineDeploymentStrategyType,
@@ -340,8 +341,8 @@ func TestMachineDeploymentReconciler(t *testing.T) {
340341
// expect old MachineSets with old labels to be deleted
341342
//
342343
oldLabels := deployment.Spec.Selector.MatchLabels
343-
oldLabels[clusterv1.MachineDeploymentLabelName] = deployment.Name
344344

345+
// Change labels and selector to a new set of labels which doesn't have any overlap with the previous labels.
345346
newLabels := map[string]string{
346347
"new-key": "new-value",
347348
clusterv1.ClusterLabelName: testCluster.Name,

0 commit comments

Comments
 (0)