From a6f22eb8b3b4980d287a3295c7f340f21be925a4 Mon Sep 17 00:00:00 2001 From: Travis Turner Date: Thu, 6 Sep 2018 09:43:21 -0500 Subject: [PATCH] replace *testing.T with interface testing.TB --- test/pilosa.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/pilosa.go b/test/pilosa.go index f6ed907ef..e7111ad92 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -129,40 +129,40 @@ func (m *Command) Reopen() error { // MustCreateIndex uses this command's API to create an index and fails the test // if there is an error. -func (m *Command) MustCreateIndex(t *testing.T, name string, opts pilosa.IndexOptions) *pilosa.Index { +func (m *Command) MustCreateIndex(tb testing.TB, name string, opts pilosa.IndexOptions) *pilosa.Index { idx, err := m.API.CreateIndex(context.Background(), name, opts) if err != nil { - t.Fatalf("creating index: %v with options: %v, err: %v", name, opts, err) + tb.Fatalf("creating index: %v with options: %v, err: %v", name, opts, err) } return idx } // MustCreateField uses this command's API to create the field. The index must // already exist - it fails the test if there is an error. -func (m *Command) MustCreateField(t *testing.T, index, field string, opts ...pilosa.FieldOption) *pilosa.Field { +func (m *Command) MustCreateField(tb testing.TB, index, field string, opts ...pilosa.FieldOption) *pilosa.Field { f, err := m.API.CreateField(context.Background(), index, field, opts...) if err != nil { - t.Fatalf("creating field: %s in index: %s err: %v", field, index, err) + tb.Fatalf("creating field: %s in index: %s err: %v", field, index, err) } return f } // MustQuery uses this command's API to execute the given query request, failing // if Query returns a non-nil error, otherwise returning the QueryResponse. -func (m *Command) MustQuery(t *testing.T, req *pilosa.QueryRequest) pilosa.QueryResponse { +func (m *Command) MustQuery(tb testing.TB, req *pilosa.QueryRequest) pilosa.QueryResponse { resp, err := m.API.Query(context.Background(), req) if err != nil { - t.Fatalf("making query: %v, err: %v", req, err) + tb.Fatalf("making query: %v, err: %v", req, err) } return resp } // MustRecalculateCaches calls RecalculateCaches on the command's API, and fails // if there is an error. -func (m *Command) MustRecalculateCaches(t *testing.T) { +func (m *Command) MustRecalculateCaches(tb testing.TB) { err := m.API.RecalculateCaches(context.Background()) if err != nil { - t.Fatalf("recalcluating caches: %v", err) + tb.Fatalf("recalcluating caches: %v", err) } } @@ -224,10 +224,10 @@ func (c Cluster) Close() error { } // MustNewCluster creates a new cluster -func MustNewCluster(t *testing.T, size int, opts ...[]server.CommandOption) Cluster { +func MustNewCluster(tb testing.TB, size int, opts ...[]server.CommandOption) Cluster { c, err := newCluster(size, opts...) if err != nil { - t.Fatalf("new cluster: %v", err) + tb.Fatalf("new cluster: %v", err) } return c } @@ -271,10 +271,10 @@ func runCluster(size int, opts ...[]server.CommandOption) (Cluster, error) { } // MustRunCluster creates and starts a new cluster -func MustRunCluster(t *testing.T, size int, opts ...[]server.CommandOption) Cluster { +func MustRunCluster(tb testing.TB, size int, opts ...[]server.CommandOption) Cluster { c, err := runCluster(size, opts...) if err != nil { - t.Fatalf("run cluster: %v", err) + tb.Fatalf("run cluster: %v", err) } return c }