2019-04-09 18:24:40 +00:00
|
|
|
package inmem
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
platform "github.com/influxdata/influxdb"
|
|
|
|
platformtesting "github.com/influxdata/influxdb/testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func initOnboardingService(f platformtesting.OnboardingFields, t *testing.T) (platform.OnboardingService, func()) {
|
|
|
|
s := NewService()
|
|
|
|
s.IDGenerator = f.IDGenerator
|
|
|
|
s.TokenGenerator = f.TokenGenerator
|
2019-05-17 15:12:09 +00:00
|
|
|
s.TimeGenerator = f.TimeGenerator
|
|
|
|
if f.TimeGenerator == nil {
|
|
|
|
s.TimeGenerator = platform.RealTimeGenerator{}
|
|
|
|
}
|
2019-04-09 18:24:40 +00:00
|
|
|
ctx := context.TODO()
|
|
|
|
if err := s.PutOnboardingStatus(ctx, !f.IsOnboarding); err != nil {
|
|
|
|
t.Fatalf("failed to set new onboarding finished: %v", err)
|
|
|
|
}
|
|
|
|
return s, func() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestGenerate(t *testing.T) {
|
|
|
|
platformtesting.Generate(initOnboardingService, t)
|
|
|
|
}
|