Skip to content

Commit 4dfaa31

Browse files
committed
Fix e2e test to verify existense of remediation CR by nodeName and not machine name when checking NodeName annotation.
Signed-off-by: Michael Shitrit <mshitrit@redhat.com>
1 parent e96b911 commit 4dfaa31

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

e2e/common_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"k8s.io/apimachinery/pkg/runtime/schema"
1212
)
1313

14-
func ensureRemediationResourceExists(name string, namespace string, remediationResource schema.GroupVersionResource) func() error {
14+
func ensureRemediationResourceExists(nodeName string, namespace string, remediationResource schema.GroupVersionResource) func() error {
1515
return func() error {
1616
// The CR name doesn't always match the node name in case multiple CRs of same type for the same node are supported
1717
// So list all, and look for the node name in the annotation
@@ -25,7 +25,7 @@ func ensureRemediationResourceExists(name string, namespace string, remediationR
2525
return err
2626
}
2727
for _, cr := range list.Items {
28-
if nodeName, exists := cr.GetAnnotations()[commonannotations.NodeNameAnnotation]; exists && nodeName == name {
28+
if annotationNodeName, exists := cr.GetAnnotations()[commonannotations.NodeNameAnnotation]; exists && annotationNodeName == nodeName {
2929
log.Info("found remediation resource")
3030
return nil
3131
}

e2e/mhc_e2e_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ const (
3131

3232
var _ = Describe("e2e - MHC", Label("MHC", labelOcpOnlyValue), func() {
3333
var nodeUnderTest *v1.Node
34-
var machineNameUnderTest string
3534
var mhc *v1beta1.MachineHealthCheck
3635
var workers *v1.NodeList
3736
var leaseName string
@@ -84,7 +83,7 @@ var _ = Describe("e2e - MHC", Label("MHC", labelOcpOnlyValue), func() {
8483
nodeUnderTest = &workers.Items[0]
8584

8685
var err error
87-
_, machineNameUnderTest, err = controllerutils.GetMachineNamespaceName(nodeUnderTest)
86+
_, _, err = controllerutils.GetMachineNamespaceName(nodeUnderTest)
8887
Expect(err).ToNot(HaveOccurred(), "failed to get machine name from node")
8988

9089
leaseName = fmt.Sprintf("%s-%s", "node", nodeUnderTest.Name)
@@ -126,7 +125,7 @@ var _ = Describe("e2e - MHC", Label("MHC", labelOcpOnlyValue), func() {
126125
By("ensuring remediation CR exists")
127126
waitTime := nodeUnhealthyTime.Add(unhealthyConditionDuration + 3*time.Second).Sub(time.Now())
128127
Eventually(
129-
ensureRemediationResourceExists(machineNameUnderTest, mhcNamespace, remediationGVR), waitTime, "500ms").
128+
ensureRemediationResourceExists(nodeUnderTest.Name, mhcNamespace, remediationGVR), waitTime, "500ms").
130129
Should(Succeed())
131130

132131
By("ensuring lease exist")

0 commit comments

Comments
 (0)