From e6a6cc9bf23a6de8d016b1296ab6c686ccd90ba5 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Mon, 2 Dec 2019 14:41:52 -0500 Subject: [PATCH] testing: refactor fetch tests to make satisfy the linter --- fetch_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fetch_test.go b/fetch_test.go index a8eae86..7db6cbe 100644 --- a/fetch_test.go +++ b/fetch_test.go @@ -46,8 +46,8 @@ func TestFetchProtocolTrip(t *testing.T) { d2 := &datastore{map[string][]byte{"key": []byte("value2")}} h2 := newFetchProtocol(ctx, hosts[1], d2.Lookup) - fetchCheck(t, ctx, h1, h2, "key", []byte("value2")) - fetchCheck(t, ctx, h2, h1, "key", []byte("value1")) + fetchCheck(ctx, t, h1, h2, "key", []byte("value2")) + fetchCheck(ctx, t, h2, h1, "key", []byte("value1")) } func TestFetchProtocolNotFound(t *testing.T) { @@ -66,8 +66,8 @@ func TestFetchProtocolNotFound(t *testing.T) { d2 := &datastore{make(map[string][]byte)} h2 := newFetchProtocol(ctx, hosts[1], d2.Lookup) - fetchCheck(t, ctx, h1, h2, "key", nil) - fetchCheck(t, ctx, h2, h1, "key", []byte("value1")) + fetchCheck(ctx, t, h1, h2, "key", nil) + fetchCheck(ctx, t, h2, h1, "key", []byte("value1")) } func TestFetchProtocolRepeated(t *testing.T) { @@ -87,12 +87,12 @@ func TestFetchProtocolRepeated(t *testing.T) { h2 := newFetchProtocol(ctx, hosts[1], d2.Lookup) for i := 0; i < 10; i++ { - fetchCheck(t, ctx, h1, h2, "key", nil) - fetchCheck(t, ctx, h2, h1, "key", []byte("value1")) + fetchCheck(ctx, t, h1, h2, "key", nil) + fetchCheck(ctx, t, h2, h1, "key", []byte("value1")) } } -func fetchCheck(t *testing.T, ctx context.Context, +func fetchCheck(ctx context.Context, t *testing.T, requester *fetchProtocol, responder *fetchProtocol, key string, expected []byte) { data, err := requester.Fetch(ctx, responder.host.ID(), key) if err != nil {