-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconnection_test.go
More file actions
48 lines (43 loc) · 1.04 KB
/
connection_test.go
File metadata and controls
48 lines (43 loc) · 1.04 KB
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 wtgo
import (
"testing"
)
// TODO need to cleanup all WiredTiger files created during testing
func TestOpen(t *testing.T) {
conn, err := Open(".", "create,cache_size=500M")
if err != nil {
t.Errorf("Open failed with %v", err)
} else {
conn.Close()
}
}
func TestOpenInvalidOpts(t *testing.T) {
conn, err := Open(".", "create,cache_size=500M,meow=mooooooo")
t.Logf("err == nil: %v", err == nil)
if err == nil {
defer conn.Close()
t.Fatalf("Open should have failed with invalid opts.")
}
}
func TestOpenSession(t *testing.T) {
conn, err := Open(".", "create")
if err != nil {
t.Errorf("Open failed with %v", err)
}
defer conn.Close()
_, err = conn.OpenSession("isolation=snapshot")
if err != nil {
t.Errorf("Failed to open session: %v", err)
}
}
func TestOpenSessionInvalidOpts(t *testing.T) {
conn, err := Open(".", "create")
if err != nil {
t.Errorf("Open failed with %v", err)
}
defer conn.Close()
_, err = conn.OpenSession("isolation=bananas")
if err == nil {
t.Errorf("Open session should have failed")
}
}