Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions test/e2e/md_rollout.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ func MachineDeploymentRolloutSpec(ctx context.Context, inputGetter func() Machin
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
}, clusterResources)

// Get all machines before doing in-place changes so we can check at the end that no machines were replaced.
machinesBeforeInPlaceChanges := getMachinesByCluster(ctx, input.BootstrapClusterProxy.GetClient(), clusterResources.Cluster)

By("Upgrade MachineDeployment in-place mutable fields and wait for in-place propagation")
framework.UpgradeMachineDeploymentInPlaceMutableFieldsAndWait(ctx, framework.UpgradeMachineDeploymentInPlaceMutableFieldsAndWaitInput{
ClusterProxy: input.BootstrapClusterProxy,
Expand All @@ -117,31 +120,6 @@ func MachineDeploymentRolloutSpec(ctx context.Context, inputGetter func() Machin
MachineDeployments: clusterResources.MachineDeployments,
})

By("Upgrading MachineDeployment Infrastructure ref and wait for rolling upgrade")
framework.UpgradeMachineDeploymentInfrastructureRefAndWait(ctx, framework.UpgradeMachineDeploymentInfrastructureRefAndWaitInput{
ClusterProxy: input.BootstrapClusterProxy,
Cluster: clusterResources.Cluster,
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
MachineDeployments: clusterResources.MachineDeployments,
})

Byf("Verify Cluster Available condition is true")
framework.VerifyClusterAvailable(ctx, framework.VerifyClusterAvailableInput{
Getter: input.BootstrapClusterProxy.GetClient(),
Name: clusterResources.Cluster.Name,
Namespace: clusterResources.Cluster.Namespace,
})

Byf("Verify Machines Ready condition is true")
framework.VerifyMachinesReady(ctx, framework.VerifyMachinesReadyInput{
Lister: input.BootstrapClusterProxy.GetClient(),
Name: clusterResources.Cluster.Name,
Namespace: clusterResources.Cluster.Namespace,
})

// Get all machines before doing in-place changes so we can check at the end that no machines were replaced.
machinesBeforeInPlaceChanges := getMachinesByCluster(ctx, input.BootstrapClusterProxy.GetClient(), clusterResources.Cluster)

preExistingAlwaysTaint := clusterv1.MachineTaint{
Key: "pre-existing-always-taint",
Value: "always-value",
Expand Down Expand Up @@ -277,9 +255,31 @@ func MachineDeploymentRolloutSpec(ctx context.Context, inputGetter func() Machin
By("Verifying there are no unexpected rollouts through in-place changes")
Consistently(func(g Gomega) {
machinesAfterInPlaceChanges := getMachinesByCluster(ctx, input.BootstrapClusterProxy.GetClient(), clusterResources.Cluster)
g.Expect(machinesAfterInPlaceChanges.Equal(machinesBeforeInPlaceChanges)).To(BeTrue(), "Machines must not be replaced through in-place rollout")
g.Expect(machinesAfterInPlaceChanges).To(BeComparableTo(machinesBeforeInPlaceChanges), "Machines must not be replaced through in-place rollout")
}, 30*time.Second, 1*time.Second).Should(Succeed())

By("Upgrading MachineDeployment Infrastructure ref and wait for rolling upgrade")
framework.UpgradeMachineDeploymentInfrastructureRefAndWait(ctx, framework.UpgradeMachineDeploymentInfrastructureRefAndWaitInput{
ClusterProxy: input.BootstrapClusterProxy,
Cluster: clusterResources.Cluster,
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
MachineDeployments: clusterResources.MachineDeployments,
})

Byf("Verify Cluster Available condition is true")
framework.VerifyClusterAvailable(ctx, framework.VerifyClusterAvailableInput{
Getter: input.BootstrapClusterProxy.GetClient(),
Name: clusterResources.Cluster.Name,
Namespace: clusterResources.Cluster.Namespace,
})

Byf("Verify Machines Ready condition is true")
framework.VerifyMachinesReady(ctx, framework.VerifyMachinesReadyInput{
Lister: input.BootstrapClusterProxy.GetClient(),
Name: clusterResources.Cluster.Name,
Namespace: clusterResources.Cluster.Namespace,
})

By("PASSED!")
})

Expand Down
Loading