2018-09-12 19:24:17 +00:00
|
|
|
package bolt_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2019-01-08 00:37:16 +00:00
|
|
|
platform "github.com/influxdata/influxdb"
|
|
|
|
platformtesting "github.com/influxdata/influxdb/testing"
|
2018-09-12 19:24:17 +00:00
|
|
|
)
|
|
|
|
|
2018-10-03 14:51:14 +00:00
|
|
|
func initOnboardingService(f platformtesting.OnboardingFields, t *testing.T) (platform.OnboardingService, func()) {
|
2019-12-04 23:10:23 +00:00
|
|
|
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
|
2019-05-17 15:12:09 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-09 16:43:58 +00:00
|
|
|
func TestOnboardingService_Generate(t *testing.T) {
|
2019-11-07 14:46:30 +00:00
|
|
|
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)
|
|
|
|
}
|