Skip to content

Commit

Permalink
Merge pull request #69 from mshitrit/stablize_e2e_tests
Browse files Browse the repository at this point in the history
Enabling e2e  tests for 4.12 ocp
  • Loading branch information
mshitrit authored Dec 20, 2022
2 parents d376d7a + d9bfa64 commit c901f32
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
33 changes: 20 additions & 13 deletions e2e/self_node_remediation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package e2e
import (
"context"
"fmt"
"os"
"strconv"
"strings"
"sync"
Expand All @@ -28,10 +29,11 @@ import (
)

const (
disconnectCommand = "ip route add blackhole %s"
reconnectCommand = "ip route delete blackhole %s"
nodeExecTimeout = 20 * time.Second
reconnectInterval = 300 * time.Second
disconnectCommand = "ip route add blackhole %s"
reconnectCommand = "ip route delete blackhole %s"
nodeExecTimeout = 20 * time.Second
reconnectInterval = 300 * time.Second
skipLogsEnvVarName = "SKIP_LOG_VERIFICATION"
)

var _ = Describe("Self Node Remediation E2E", func() {
Expand Down Expand Up @@ -152,8 +154,10 @@ var _ = Describe("Self Node Remediation E2E", func() {
checkNoNodeRecreate(node, oldUID)
checkNoReboot(node, oldBootTime)

// check logs to make sure that the actual peer health check did run
checkSnrLogs(node, []string{"failed to check api server", "Peer told me I'm healthy."})
if _, isExist := os.LookupEnv(skipLogsEnvVarName); !isExist {
// check logs to make sure that the actual peer health check did run
checkSnrLogs(node, []string{"failed to check api server", "Peer told me I'm healthy."})
}
})
})

Expand Down Expand Up @@ -189,10 +193,11 @@ var _ = Describe("Self Node Remediation E2E", func() {
checkReboot(node, oldBootTime)
checkPodRecreated(node, oldPodCreationTime)
checkVaDeleted(va)

// we can't check logs of unhealthy node anymore, check peer logs
peer := &workers.Items[1]
checkSnrLogs(peer, []string{node.GetName(), "node is unhealthy"})
if _, isExist := os.LookupEnv(skipLogsEnvVarName); !isExist {
// we can't check logs of unhealthy node anymore, check peer logs
peer := &workers.Items[1]
checkSnrLogs(peer, []string{node.GetName(), "node is unhealthy"})
}
})

})
Expand Down Expand Up @@ -253,8 +258,10 @@ var _ = Describe("Self Node Remediation E2E", func() {
checkNoNodeRecreate(worker, uids[worker.GetName()])
checkNoReboot(worker, bootTimes[worker.GetName()])

// check logs to make sure that the actual peer health check did run
checkSnrLogs(worker, []string{"failed to check api server", "nodes couldn't access the api-server"})
if _, isExist := os.LookupEnv(skipLogsEnvVarName); !isExist {
// check logs to make sure that the actual peer health check did run
checkSnrLogs(worker, []string{"failed to check api server", "nodes couldn't access the api-server"})
}
}()
}
wg.Wait()
Expand Down Expand Up @@ -595,7 +602,7 @@ func restartSnrPod(node *v1.Node) {

//no need to restart the pod
for _, cond := range pod.Status.Conditions {
if cond.Type == v1.PodReady && cond.Status == v1.ConditionTrue{
if cond.Type == v1.PodReady && cond.Status == v1.ConditionTrue {
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/utils/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ func WaitForPodReady(c client.Client, pod *corev1.Pod) {
}
}
return corev1.ConditionUnknown
}, 2*time.Minute, 10*time.Second).Should(Equal(corev1.ConditionTrue), "pod did not get ready in time")
}, 4*time.Minute, 10*time.Second).Should(Equal(corev1.ConditionTrue), "pod did not get ready in time")
}

0 comments on commit c901f32

Please sign in to comment.