forked from couchbase/gocb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bucket_test.go
48 lines (36 loc) · 839 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package gocb
import (
"flag"
"fmt"
"os"
"testing"
"gopkg.in/couchbaselabs/gojcbmock.v1"
)
var globalBucket *Bucket
var globalMock *gojcbmock.Mock
var globalCluster *Cluster
func TestMain(m *testing.M) {
SetLogger(VerboseStdioLogger())
flag.Parse()
mpath, err := gojcbmock.GetMockPath()
if err != nil {
panic(err.Error())
}
globalMock, err = gojcbmock.NewMock(mpath, 4, 1, 64, []gojcbmock.BucketSpec{
{Name: "default", Type: gojcbmock.BCouchbase},
{Name: "memd", Type: gojcbmock.BMemcached},
}...)
if err != nil {
panic(err.Error())
}
connStr := fmt.Sprintf("http://127.0.0.1:%d", globalMock.EntryPort)
globalCluster, err = Connect(connStr)
if err != nil {
panic(err.Error())
}
globalBucket, err = globalCluster.OpenBucket("default", "")
if err != nil {
panic(err.Error())
}
os.Exit(m.Run())
}