Skip to content

Commit

Permalink
e2e-test: assert job condition on job tests
Browse files Browse the repository at this point in the history
We have elaborate condition checks on a job's pods, but we do not test
the job status itself, which will produce wrong test results. A test
for job that always fails (cmd: /bin/false) will pass.

This keeps the current assertions in-place, but makes the test fail on a
failed job status

Signed-off-by: Magnus Kulke <[email protected]>
  • Loading branch information
mkulke authored and wainersm committed Aug 5, 2024
1 parent ecaf1c3 commit 09c6c83
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cloud-api-adaptor/test/e2e/assessment_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ func (tc *TestCase) Run() {
var podlist v1.PodList

if tc.job != nil {
conditions := tc.job.Status.Conditions
if len(conditions) == 1 && conditions[0].Type == batchv1.JobFailed {
t.Errorf("Job failed")
}

if err := client.Resources(tc.job.Namespace).List(ctx, &podlist); err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 09c6c83

Please sign in to comment.