Skip to content

Commit

Permalink
tinker with timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
fearful-symmetry committed Sep 20, 2024
1 parent 15f7f4e commit d1f8406
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions testing/testrunner/ebpf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,6 @@ func Tcpv6ConnectionClose(t *testing.T, et *Runner) {
}

func TestEbpf(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
defer cancel()

hasOverlayFS := IsOverlayFsSupported(t)

testCases := []struct {
Expand Down Expand Up @@ -624,18 +621,25 @@ func TestEbpf(t *testing.T) {
{"FileRenameContainer", FileRenameContainer, []string{"--file-rename"}, true},
{"FileDeleteContainer", FileDeleteContainer, []string{"--file-delete"}, true},
}

// small hack to make sure we don't continue to run tests when the first one fails
failed := false
for _, test := range testCases {
if failed {
return
}
t.Run(test.name, func(t *testing.T) {
if test.requireOverlayFS && !hasOverlayFS {
t.Skipf("Test requires OverlayFS, not available")
}
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*2)
defer cancel()
run := NewEbpfRunner(ctx, t, test.args...)
// on return, check for failure. If we've failed, dump stderr and stdout
defer func() {
if t.Failed() {
PrintDebugOutputOnFail()
run.Dump()
failed = true
}
}()

Expand Down

0 comments on commit d1f8406

Please sign in to comment.