forked from influxdata/influxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbucket_test.go
34 lines (30 loc) · 856 Bytes
/
bucket_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package inmem
import (
"context"
"testing"
platform "github.com/influxdata/influxdb"
platformtesting "github.com/influxdata/influxdb/testing"
)
func initBucketService(f platformtesting.BucketFields, t *testing.T) (platform.BucketService, string, func()) {
s := NewService()
s.IDGenerator = f.IDGenerator
s.TimeGenerator = f.TimeGenerator
if f.TimeGenerator == nil {
s.TimeGenerator = platform.RealTimeGenerator{}
}
ctx := context.Background()
for _, o := range f.Organizations {
if err := s.PutOrganization(ctx, o); err != nil {
t.Fatalf("failed to populate organizations")
}
}
for _, b := range f.Buckets {
if err := s.PutBucket(ctx, b); err != nil {
t.Fatalf("failed to populate buckets")
}
}
return s, OpPrefix, func() {}
}
func TestBucketService(t *testing.T) {
platformtesting.BucketService(initBucketService, t)
}