forked from compose/transporter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrethinkdb_test.go
49 lines (43 loc) · 1.11 KB
/
rethinkdb_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
49
package rethinkdb
import (
"sync"
"testing"
"github.com/compose/transporter/adaptor"
)
func TestDescription(t *testing.T) {
r := rethinkDB{}
if r.Description() != description {
t.Errorf("unexpected Description, expected %s, got %s\n", description, r.Description())
}
}
func TestSampleConfig(t *testing.T) {
r := rethinkDB{}
if r.SampleConfig() != sampleConfig {
t.Errorf("unexpected SampleConfig, expected %s, got %s\n", sampleConfig, r.SampleConfig())
}
}
var initTests = []map[string]interface{}{
{"uri": DefaultURI},
{"uri": DefaultURI, "tail": true},
}
func TestInit(t *testing.T) {
for _, it := range initTests {
a, err := adaptor.GetAdaptor("rethinkdb", it)
if err != nil {
t.Fatalf("unexpected GetV2() error, %s", err)
}
if _, err := a.Client(); err != nil {
t.Errorf("unexpected Client() error, %s", err)
}
if _, err := a.Reader(); err != nil {
t.Errorf("unexpected Reader() error, %s", err)
}
done := make(chan struct{})
var wg sync.WaitGroup
if _, err := a.Writer(done, &wg); err != nil {
t.Errorf("unexpected Writer() error, %s", err)
}
close(done)
wg.Wait()
}
}