Skip to content

Commit

Permalink
More checks and better formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Nov 8, 2024
1 parent f82afd3 commit 0019197
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/osquery/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ func waitShutdown(t *testing.T, runner *Runner, logBytes *threadsafebuffer.Threa

select {
case err := <-shutdownErr:
require.NoError(t, err, fmt.Sprintf("runner logs: %s", logBytes.String()))
require.NoError(t, err, fmt.Sprintf("runner logs:\n\n%s", logBytes.String()))
case <-time.After(1 * time.Minute):
t.Error("runner did not shut down within timeout", fmt.Sprintf("runner logs: %s", logBytes.String()))
t.FailNow()
Expand All @@ -502,7 +502,7 @@ func waitHealthy(t *testing.T, runner *Runner, logBytes *threadsafebuffer.Thread

// Good to go
return nil
}, 30*time.Second, 1*time.Second), fmt.Sprintf("instance not healthy by %s: runner logs: %s", time.Now().String(), logBytes.String()))
}, 30*time.Second, 1*time.Second), fmt.Sprintf("instance not healthy by %s: runner logs:\n\n%s", time.Now().String(), logBytes.String()))

// Give the instance just a little bit of buffer before we proceed
time.Sleep(2 * time.Second)
Expand Down Expand Up @@ -652,6 +652,8 @@ func TestOsqueryDies(t *testing.T) {

waitHealthy(t, runner, logBytes)

require.Contains(t, runner.instances, defaultRegistrationId)
require.NotNil(t, runner.instances[defaultRegistrationId].stats)
previousStats := runner.instances[defaultRegistrationId].stats

// Simulate the osquery process unexpectedly dying
Expand Down

0 comments on commit 0019197

Please sign in to comment.