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
8 changes: 5 additions & 3 deletions test/e2e/ha/ha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,11 @@ func corruptAndRecover(f *framework.Framework, deploy *appsv1.Deployment, dbFile
newNodes.Clear()
for pod := range slices.Values(pods.Items) {
newNodes.Insert(pod.Spec.NodeName)
ginkgo.By("Checking whether db file " + dbFile + " on node " + pod.Spec.NodeName + " is healthy")
stdout, stderr, err := framework.ExecShellInPod(context.Background(), f, pod.Namespace, pod.Name, checkCmd)
framework.ExpectNoError(err, fmt.Sprintf("failed to check db file %q: stdout = %q, stderr = %q", dbFile, stdout, stderr))
ginkgo.By("Waiting for db file " + dbFile + " on node " + pod.Spec.NodeName + " to be healthy")
framework.WaitUntil(2*time.Second, 30*time.Second, func(_ context.Context) (bool, error) {
_, _, err := framework.ExecShellInPod(context.Background(), f, pod.Namespace, pod.Name, checkCmd)
return err == nil, nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve debuggability, especially if the WaitUntil loop times out, it would be helpful to log the stdout and stderr when ExecShellInPod returns an error. This provides more context about why the check-cluster command failed during a retry attempt.

			if err != nil {
				framework.Logf("check-cluster failed for %s on %s: err = %v, stdout = %q, stderr = %q", dbFile, pod.Spec.NodeName, err, stdout, stderr)
				return false, nil
			}
			return true, nil

}, fmt.Sprintf("db file %s on node %s to be healthy", dbFile, pod.Spec.NodeName))
}
framework.ExpectEqual(newNodes, nodes, "the set of nodes hosting ovn-central pods should be the same as before")

Expand Down
Loading