forked from hashicorp/consul-replicate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner_test.go
64 lines (52 loc) · 1.38 KB
/
runner_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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"os"
"reflect"
"testing"
)
func TestNewRunner_initialize(t *testing.T) {
once := true
config := &Config{
Prefixes: []*Prefix{
&Prefix{SourceRaw: "1", Destination: "4"},
&Prefix{SourceRaw: "2", Destination: "5"},
&Prefix{SourceRaw: "3", Destination: "6"},
&Prefix{SourceRaw: "4", Destination: "7"},
},
Excludes: []*Exclude{
&Exclude{Source: "3"},
},
}
runner, err := NewRunner(config, once)
if err != nil {
t.Fatal(err)
}
// check the items we set in the config
if !reflect.DeepEqual(runner.config.Prefixes, config.Prefixes) {
t.Errorf("expected %#v to be %#v", runner.config.Prefixes, config.Prefixes)
}
if runner.once != once {
t.Errorf("expected %#v to be %#v", runner.once, once)
}
if runner.client == nil {
t.Errorf("expected %#v to not be %#v", runner.client, nil)
}
if runner.watcher == nil {
t.Errorf("expected %#v to not be %#v", runner.watcher, nil)
}
if runner.data == nil {
t.Errorf("expected %#v to not be %#v", runner.data, nil)
}
if runner.outStream != os.Stdout {
t.Errorf("expected %#v to be %#v", runner.outStream, os.Stdout)
}
if runner.errStream != os.Stderr {
t.Errorf("expected %#v to be %#v", runner.errStream, os.Stderr)
}
if runner.ErrCh == nil {
t.Errorf("expected %#v to be %#v", runner.ErrCh, nil)
}
if runner.DoneCh == nil {
t.Errorf("expected %#v to be %#v", runner.DoneCh, nil)
}
}