Skip to content

Commit

Permalink
add logs to debug flaky test
Browse files Browse the repository at this point in the history
Signed-off-by: Swagat Bora <[email protected]>
  • Loading branch information
swagatbora90 committed Sep 26, 2024
1 parent 81c6e22 commit a12e0c5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions runtime/service_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,13 +946,17 @@ func startAndWaitTask(ctx context.Context, t testing.TB, c containerd.Container)
assert.NoError(t, exitStatus.Error(), "failed to retrieve exitStatus")
assert.Equal(t, uint32(0), exitStatus.ExitCode())

// Print stderr to help with debugging
stderrOutput := stderr.String()
if len(stderrOutput) != 0 {
fmt.Printf("stderr output from container %s: %s", c.ID(), stderrOutput)
}

status, err := task.Delete(ctx)
assert.NoErrorf(t, err, "failed to delete task %q after exit", c.ID())
if status != nil {
assert.NoError(t, status.Error())
}

assert.Equal(t, "", stderr.String())
case <-ctx.Done():
require.Fail(t, "context cancelled",
"context cancelled while waiting for container %s to exit, err: %v", c.ID(), ctx.Err())
Expand Down

0 comments on commit a12e0c5

Please sign in to comment.