influxdb/bolt/onboarding_test.go

39 lines
1.0 KiB
Go
Raw Normal View History

2018-09-12 19:24:17 +00:00
package bolt_test
import (
"context"
"testing"
platform "github.com/influxdata/influxdb"
platformtesting "github.com/influxdata/influxdb/testing"
2018-09-12 19:24:17 +00:00
)
func initOnboardingService(f platformtesting.OnboardingFields, t *testing.T) (platform.OnboardingService, func()) {
c, closeFn, err := NewTestClient(t)
2018-09-12 19:24:17 +00:00
if err != nil {
t.Fatalf("failed to create new bolt client: %v", err)
}
c.IDGenerator = f.IDGenerator
c.TokenGenerator = f.TokenGenerator
c.TimeGenerator = f.TimeGenerator
if c.TimeGenerator == nil {
c.TimeGenerator = platform.RealTimeGenerator{}
}
2018-09-12 19:24:17 +00:00
ctx := context.TODO()
if err = c.PutOnboardingStatus(ctx, !f.IsOnboarding); err != nil {
t.Fatalf("failed to set new onboarding finished: %v", err)
}
return c, func() {
defer closeFn()
if err := c.PutOnboardingStatus(ctx, false); err != nil {
t.Logf("failed to remove onboarding finished: %v", err)
}
}
}
func TestOnboardingService_Generate(t *testing.T) {
t.Skip("This service is not used, we use the kv bolt implementation")
2018-09-12 19:24:17 +00:00
platformtesting.Generate(initOnboardingService, t)
}