Skip to content

Commit

Permalink
fix: tests should pass now
Browse files Browse the repository at this point in the history
deleted tests for dead code

removed a test runner for the variable service from http - doesn't really make sense to run it from there
  • Loading branch information
dearyhud committed Nov 1, 2019
1 parent 6e4be11 commit 148175f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 118 deletions.
45 changes: 0 additions & 45 deletions bolt/variable_test.go

This file was deleted.

35 changes: 0 additions & 35 deletions http/variable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"go.uber.org/zap"

platform "github.com/influxdata/influxdb"
"github.com/influxdata/influxdb/inmem"
"github.com/influxdata/influxdb/mock"
platformtesting "github.com/influxdata/influxdb/testing"
"github.com/julienschmidt/httprouter"
Expand Down Expand Up @@ -887,37 +886,3 @@ func TestService_handlePostVariableLabel(t *testing.T) {
})
}
}

func initVariableService(f platformtesting.VariableFields, t *testing.T) (platform.VariableService, string, func()) {
t.Helper()

svc := inmem.NewService()
svc.IDGenerator = f.IDGenerator
svc.TimeGenerator = f.TimeGenerator
if f.TimeGenerator == nil {
svc.TimeGenerator = platform.RealTimeGenerator{}
}

ctx := context.Background()
for _, variable := range f.Variables {
if err := svc.ReplaceVariable(ctx, variable); err != nil {
t.Fatalf("failed to populate variables")
}
}

variableBackend := NewMockVariableBackend()
variableBackend.HTTPErrorHandler = ErrorHandler(0)
variableBackend.VariableService = svc
handler := NewVariableHandler(variableBackend)
server := httptest.NewServer(handler)
client := VariableService{
Addr: server.URL,
}
done := server.Close

return &client, inmem.OpPrefix, done
}

func TestVariableService(t *testing.T) {
platformtesting.VariableService(initVariableService, t)
}
35 changes: 0 additions & 35 deletions inmem/variable_test.go

This file was deleted.

6 changes: 3 additions & 3 deletions testing/variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func CreateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
Variables: []*platform.Variable{
{
ID: MustIDBase16(idB),
OrganizationID: platform.ID(3),
OrganizationID: MustIDBase16(idD),
Name: "existing-variable",
Selected: []string{"b"},
Arguments: &platform.VariableArguments{
Expand All @@ -241,7 +241,7 @@ func CreateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
args: args{
variable: &platform.Variable{
ID: MustIDBase16(idA),
OrganizationID: platform.ID(3),
OrganizationID: MustIDBase16(idD),
Name: "existing-variable",
Selected: []string{"a"},
Arguments: &platform.VariableArguments{
Expand All @@ -262,7 +262,7 @@ func CreateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
variables: []*platform.Variable{
{
ID: MustIDBase16(idB),
OrganizationID: platform.ID(3),
OrganizationID: MustIDBase16(idD),
Name: "existing-variable",
Selected: []string{"b"},
Arguments: &platform.VariableArguments{
Expand Down

0 comments on commit 148175f

Please sign in to comment.