Skip to content

Commit f0fdaa9

Browse files
Merge pull request #29827 from vr4manta/SPLAT-2231
SPLAT-2231: Updated tests to work with hybrid environments
2 parents 6c48344 + 2c345f2 commit f0fdaa9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

test/extended/machines/cluster.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,16 @@ var _ = g.Describe("[sig-cluster-lifecycle][Feature:Machines][Early] Managed clu
6464
machineList := objx.Map(obj.UnstructuredContent())
6565
machineItems := objects(machineList.Get("items"))
6666

67+
// Get number of nodes with machine annotation ("machine.openshift.io/machine")
68+
machineNodes := 0
69+
for _, node := range nodeItems {
70+
if _, ok := node.Annotations["machine.openshift.io/machine"]; ok {
71+
machineNodes++
72+
}
73+
}
74+
6775
g.By("ensure number of Machines and Nodes are equal")
68-
o.Expect(len(nodeItems)).To(o.Equal(len(machineItems)))
76+
o.Expect(machineNodes).To(o.Equal(len(machineItems)))
6977
})
7078
})
7179

test/extended/machines/machines.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ var _ = g.Describe("[sig-cluster-lifecycle][Feature:Machines] Managed cluster sh
6464
nodeNames := sets.NewString()
6565
for i := range allNodes.Items {
6666
node := &allNodes.Items[i]
67-
nodeNames.Insert(node.ObjectMeta.Name)
67+
68+
// If the node does not have the label, it may be a non machine node.
69+
if _, ok := node.Annotations["machine.openshift.io/machine"]; ok {
70+
nodeNames.Insert(node.ObjectMeta.Name)
71+
}
6872
}
6973

7074
if len(nodeNames) == 0 {

0 commit comments

Comments
 (0)