wip: make CI stable#189
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR aims to improve CI stability by adding better error diagnostics to the e2e test suite. The changes focus on capturing and displaying additional debug information when tests fail, particularly around kubectl operations and Job status checks.
Key changes:
- Enhanced error messages in
GetObjectfunction to include stderr output from kubectl commands - Added debug output for failed Job assertions to help diagnose CI flakiness
- Captured Job status information that can be displayed when Eventually assertions fail
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/e2e/multik8s/testutil/util.go | Captures stderr from kubectl commands and adds debug logging for Job failures in WriteRandomDataToPV function |
| test/e2e/multik8s/misc_test.go | Adds debug output for Job listing to help diagnose failures when waiting for Jobs to fail |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Eventually(ctx, func(g Gomega) { | ||
| job, err := GetJob(cluster, namespace, writeJobName) | ||
| g.Expect(err).NotTo(HaveOccurred()) | ||
| debugJob = job.String() // for debugging |
There was a problem hiding this comment.
The job.String() method call is invalid. Kubernetes *batchv1.Job objects don't have a String() method, so this will use Go's default string representation which produces unhelpful output like &{...}.
To get useful debugging information, consider using json.Marshal() to serialize the job object:
debugJobBytes, _ := json.Marshal(job)
debugJob = string(debugJobBytes)| debugJob = job.String() // for debugging | |
| debugJobBytes, _ := json.Marshal(job) | |
| debugJob = string(debugJobBytes) // for debugging |
| g.Expect(err).NotTo(HaveOccurred()) | ||
| g.Expect(IsJobConditionTrue(job.Status.Conditions, batchv1.JobComplete)).To(BeFalse()) | ||
| }).Should(Succeed()) | ||
| }).Should(Succeed(), "jobs:\n", string(debugJobs)) |
There was a problem hiding this comment.
The Should() method is being called with multiple separate string arguments, but Gomega expects a single concatenated message string. This will not produce the expected failure message format.
Change this to:
}).Should(Succeed(), "jobs:\n"+string(debugJobs))| }).Should(Succeed(), "jobs:\n", string(debugJobs)) | |
| }).Should(Succeed(), "jobs:\n"+string(debugJobs)) |
No description provided.