Skip to content

Commit

Permalink
feat: print last output when doWaitFor times out (#117)
Browse files Browse the repository at this point in the history
* feat: print last output when doWaitFor times out

* fix test
  • Loading branch information
mhmd-azeez authored Jul 10, 2024
1 parent d0f850a commit 1a5969e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion exp/teatest/teatest.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func doWaitFor(r io.Reader, condition func(bts []byte) bool, options ...WaitForO
}
time.Sleep(wf.CheckInterval)
}
return fmt.Errorf("WaitFor: condition not met after %s", wf.Duration)
return fmt.Errorf("WaitFor: condition not met after %s. Last output:\n%s", wf.Duration, b.String())
}

// TestModel is a model that is being tested.
Expand Down
2 changes: 1 addition & 1 deletion exp/teatest/teatest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestWaitForTimeout(t *testing.T) {
if err == nil {
t.Fatal("expected an error, got nil")
}
if err.Error() != "WaitFor: condition not met after 1ms" {
if err.Error() != "WaitFor: condition not met after 1ms. Last output:\nnope" {
t.Fatalf("unexpected error: %s", err.Error())
}
}
Expand Down

0 comments on commit 1a5969e

Please sign in to comment.