mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
replace *testing.T with interface testing.TB
This commit is contained in:
parent
0ac1e25a07
commit
a6f22eb8b3
1 changed files with 12 additions and 12 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue