Skip to content

Commit

Permalink
Test that profiles aren't accessible before profiling started
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Jan 10, 2023
1 parent 760eb74 commit 2e885e5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/monitor_test.go
Expand Up @@ -4553,8 +4553,19 @@ func TestMonitorProfilez(t *testing.T) {
s := RunServer(DefaultOptions())
defer s.Shutdown()

// First of all, check that the profiles aren't accessible
// when profiling hasn't been started in the usual way.
if ps := s.profilez(&ProfilezOptions{
Name: "allocs", Debug: 0,
}); ps.Error == "" {
t.Fatal("Profile should not be accessible when profiling not started")
}

// Then start profiling.
s.StartProfiler()

// Now check that all of the profiles that we expect are
// returning instead of erroring.
for _, try := range []*ProfilezOptions{
{Name: "allocs", Debug: 0},
{Name: "allocs", Debug: 1},
Expand Down

0 comments on commit 2e885e5

Please sign in to comment.