forked from custompro98/rambler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap_test.go
58 lines (52 loc) · 1.09 KB
/
bootstrap_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
package main
import (
"testing"
)
func TestBootstrap(t *testing.T) {
var cases = []struct {
configuration string
environment string
err bool
initialized bool
}{
{
configuration: "testdata/valid.json",
environment: "default",
err: false,
initialized: true,
},
{
configuration: "testdata/invalid.json",
environment: "default",
err: true,
initialized: false,
},
{
configuration: "testdata/valid.json",
environment: "unknown",
err: true,
initialized: false,
},
{
configuration: "testdata/faulty.json",
environment: "faulty",
err: true,
initialized: false,
},
}
for n, c := range cases {
service = nil
logger = nil
err := bootstrap(c.configuration, c.environment, false, false)
if (err != nil) != c.err {
t.Error("case", n, "got unexpected error:", err)
continue
}
if logger == nil {
t.Error("case", n, "got an uninitialized logger")
}
if (service != nil) != c.initialized {
t.Error("case", n, "got unexpected service:", service)
}
}
}