Skip to content

Commit 9a86fba

Browse files
.
1 parent 869d283 commit 9a86fba

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

test/extended/machine_config/helpers.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -703,33 +703,34 @@ func WaitForNodeCurrentConfig(oc *exutil.CLI, nodeName string, config string) {
703703
}, 5*time.Minute, 10*time.Second).Should(o.BeTrue(), "Timed out waiting for node '%v' to have a current config version of '%v'.", nodeName, config)
704704
}
705705

706-
// `GetCordonedNode` returns the cordoned node when the corresponding MCP starts updating
707-
func GetCordonedNode(oc *exutil.CLI, mcpName string) corev1.Node {
706+
// `GetUpdatingNode` returns the updating node, determined by the node targetting a new desired
707+
// config, when the corresponding MCP starts updating
708+
func GetUpdatingNode(oc *exutil.CLI, mcpName, originalConfigVersion string) corev1.Node {
708709
// Wait for the MCP to start updating
709710
o.Expect(WaitForMCPConditionStatus(oc, mcpName, mcfgv1.MachineConfigPoolUpdating, corev1.ConditionTrue, 3*time.Minute, 2*time.Second)).NotTo(o.HaveOccurred(), "Waiting for 'Updating' status change failed.")
710711

711-
// Get first cordoned node & return it
712-
var cordonedNode corev1.Node
712+
// Get first updating node & return it
713+
var updatingNode corev1.Node
713714
o.Eventually(func() bool {
714-
framework.Logf("Trying to get cordoned node in '%v' MCP.", mcpName)
715+
framework.Logf("Trying to get updating node in '%v' MCP.", mcpName)
715716

716717
// Get nodes in MCP
717718
nodes, nodeErr := GetNodesByRole(oc, mcpName)
718719
o.Expect(nodeErr).NotTo(o.HaveOccurred(), "Error getting nodes from %v MCP.", mcpName)
719720
o.Expect(nodes).ShouldNot(o.BeEmpty(), "No nodes found for %v MCP.", mcpName)
720721

721-
// Loop through nodes to see which is cordoned
722+
// Loop through nodes to see which is targetting a new desired config version
722723
for _, node := range nodes {
723-
if node.Spec.Unschedulable {
724-
cordonedNode = node
724+
if node.Annotations[desiredConfigAnnotationKey] != originalConfigVersion {
725+
updatingNode = node
725726
return true
726727
}
727728
}
728729

729730
return false
730-
}, 1*time.Minute, 5*time.Second).Should(o.BeTrue())
731+
}, 30*time.Second, 1*time.Second).Should(o.BeTrue())
731732

732-
return cordonedNode
733+
return updatingNode
733734
}
734735

735736
// `WaitForMCPConditionStatus` waits up to the desired timeout for the desired MCP condition to match the desired status (ex. wait until "Updating" is "True")

test/extended/machine_config/machine_config_node.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ func ValidateMCNConditionTransitionsOnRebootlessUpdateMaster(oc *exutil.CLI, cli
239239
poolName := master
240240
mcName := fmt.Sprintf("90-%v-testfile", poolName)
241241

242+
// Get the starting config version
243+
mcp, mcpErr := clientSet.MachineconfigurationV1().MachineConfigPools().Get(context.TODO(), poolName, metav1.GetOptions{})
244+
o.Expect(mcpErr).NotTo(o.HaveOccurred(), fmt.Sprintf("Could not get MCP '%v'; %v", poolName, mcpErr))
245+
startingConfigVersion := mcp.Spec.Configuration.Name
246+
242247
// Remove node disruption policy on test completion or failure
243248
defer func() {
244249
// Apply empty MachineConfiguration fixture to remove previously set NodeDisruptionPolicy
@@ -267,7 +272,7 @@ func ValidateMCNConditionTransitionsOnRebootlessUpdateMaster(oc *exutil.CLI, cli
267272
o.Expect(mcErr).NotTo(o.HaveOccurred(), "Could not apply MachineConfig.")
268273

269274
// Get the updating node
270-
updatingNode := GetCordonedNode(oc, poolName)
275+
updatingNode := GetUpdatingNode(oc, poolName, startingConfigVersion)
271276
o.Expect(updatingNode).NotTo(o.BeNil(), "Could not get updating node.")
272277
framework.Logf("Node '%v' is updating.", updatingNode.Name)
273278

0 commit comments

Comments
 (0)