Skip to content

Commit

Permalink
server: mark testDrainContext assertion methods as test helpers
Browse files Browse the repository at this point in the history
The error messages in cases like cockroachdb#86974 are not useful otherwise.
This change allows us to see where the assertion method was called
from.

Release justification: testing only.
  • Loading branch information
nvanbenschoten committed Sep 6, 2022
1 parent 47069e9 commit 9998346
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/server/drain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,21 @@ func (t *testDrainContext) sendShutdown() *serverpb.DrainResponse {
}

func (t *testDrainContext) assertDraining(resp *serverpb.DrainResponse, drain bool) {
t.Helper()
if resp.IsDraining != drain {
t.Fatalf("expected draining %v, got %v", drain, resp.IsDraining)
}
}

func (t *testDrainContext) assertRemaining(resp *serverpb.DrainResponse, remaining bool) {
t.Helper()
if actualRemaining := (resp.DrainRemainingIndicator > 0); remaining != actualRemaining {
t.Fatalf("expected remaining %v, got %v", remaining, actualRemaining)
}
}

func (t *testDrainContext) assertEqual(expected int, actual int) {
t.Helper()
if expected == actual {
return
}
Expand Down

0 comments on commit 9998346

Please sign in to comment.