Skip to content

Commit

Permalink
move ctx param to the front
Browse files Browse the repository at this point in the history
to appease linter

Signed-off-by: Tobias Grieger <tobias.b.grieger@gmail.com>
  • Loading branch information
tbg committed Sep 20, 2022
1 parent f62b9d5 commit 894e5cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions raft/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func TestNodeProposeConfig(t *testing.T) {
func TestNodeProposeAddDuplicateNode(t *testing.T) {
s := newTestMemoryStorage(withPeers(1))
cfg := newTestConfig(1, 10, 1, s)
ctx, cancel, n := newNodeTestHarness(t, context.Background(), cfg)
ctx, cancel, n := newNodeTestHarness(context.Background(), t, cfg)
defer cancel()
n.Campaign(ctx)
allCommittedEntries := make([]raftpb.Entry, 0)
Expand Down Expand Up @@ -590,7 +590,7 @@ func TestNodeStart(t *testing.T) {
MaxInflightMsgs: 256,
}
n := StartNode(c, []Peer{{ID: 1}})
ctx, cancel, n := newNodeTestHarness(t, context.Background(), c, Peer{ID: 1})
ctx, cancel, n := newNodeTestHarness(context.Background(), t, c, Peer{ID: 1})
defer cancel()

{
Expand Down Expand Up @@ -740,7 +740,7 @@ func TestNodeAdvance(t *testing.T) {
MaxSizePerMsg: noLimit,
MaxInflightMsgs: 256,
}
ctx, cancel, n := newNodeTestHarness(t, context.Background(), c)
ctx, cancel, n := newNodeTestHarness(context.Background(), t, c)
defer cancel()

n.Campaign(ctx)
Expand Down Expand Up @@ -895,7 +895,7 @@ func TestCommitPagination(t *testing.T) {
s := newTestMemoryStorage(withPeers(1))
cfg := newTestConfig(1, 10, 1, s)
cfg.MaxCommittedSizePerReady = 2048
ctx, cancel, n := newNodeTestHarness(t, context.Background(), cfg)
ctx, cancel, n := newNodeTestHarness(context.Background(), t, cfg)
defer cancel()
n.Campaign(ctx)

Expand Down
2 changes: 1 addition & 1 deletion raft/node_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (l *nodeTestHarness) Panicf(format string, v ...interface{}) {
panic(fmt.Sprintf(format, v...))
}

func newNodeTestHarness(t *testing.T, ctx context.Context, cfg *Config, peers ...Peer) (_ context.Context, cancel func(), _ *nodeTestHarness) {
func newNodeTestHarness(ctx context.Context, t *testing.T, cfg *Config, peers ...Peer) (_ context.Context, cancel func(), _ *nodeTestHarness) {
// Wrap context in a 10s timeout to make tests more robust. Otherwise,
// it's likely that deadlock will occur unless Node behaves exactly as
// expected - when you expect a Ready and start waiting on the channel
Expand Down

0 comments on commit 894e5cb

Please sign in to comment.