forked from ipfs/go-ds-crdt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crdt_norace_test.go
45 lines (39 loc) · 878 Bytes
/
crdt_norace_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
35
36
37
38
39
40
41
42
43
44
45
//go:build !race
// +build !race
package crdt
import (
"context"
"testing"
"time"
query "github.com/ipfs/go-datastore/query"
dstest "github.com/ipfs/go-datastore/test"
)
func TestDatastoreSuite(t *testing.T) {
ctx := context.Background()
numReplicasOld := numReplicas
numReplicas = 1
defer func() {
numReplicas = numReplicasOld
}()
opts := DefaultOptions()
opts.MaxBatchDeltaSize = 200 * 1024 * 1024 // 200 MB
replicas, closeReplicas := makeReplicas(t, opts)
defer closeReplicas()
dstest.SubtestAll(t, replicas[0])
time.Sleep(time.Second)
for _, r := range replicas {
q := query.Query{KeysOnly: true}
results, err := r.Query(ctx, q)
if err != nil {
t.Fatal(err)
}
defer results.Close()
rest, err := results.Rest()
if err != nil {
t.Fatal(err)
}
if len(rest) != 0 {
t.Error("all elements in the suite should be gone")
}
}
}