forked from cayleygraph/cayley
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmongo_test.go
44 lines (34 loc) · 817 Bytes
/
mongo_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
// +build docker
package mongo
import (
"testing"
"github.com/cayleygraph/cayley/graph"
"github.com/cayleygraph/cayley/graph/nosql"
"github.com/cayleygraph/cayley/graph/nosql/nosqltest"
"github.com/cayleygraph/cayley/internal/dock"
)
func makeMongo(t testing.TB) (nosql.Database, *nosql.Options, graph.Options, func()) {
var conf dock.Config
conf.Image = "mongo:3"
conf.OpenStdin = true
conf.Tty = true
addr, closer := dock.RunAndWait(t, conf, "27017", nil)
qs, err := dialDB(addr, nil)
if err != nil {
closer()
t.Fatal(err)
}
return qs, nil, nil, func() {
qs.Close()
closer()
}
}
var conf = &nosqltest.Config{
TimeInMs: true,
}
func TestMongo(t *testing.T) {
nosqltest.TestAll(t, makeMongo, conf)
}
func BenchmarkMongo(t *testing.B) {
nosqltest.BenchmarkAll(t, makeMongo, conf)
}