forked from kelseyhightower/confd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_test.go
49 lines (47 loc) · 1.25 KB
/
config_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 main
import (
"testing"
)
func TestLoadConfig(t *testing.T) {
var expected = struct {
clientCert string
clientKey string
configDir string
etcdNodes []string
interval int
prefix string
templateDir string
}{
"", "", "/etc/confd/conf.d", []string{"http://127.0.0.1:4001"},
600, "/", "/etc/confd/templates",
}
loadConfig("")
cc := ClientCert()
if cc != expected.clientCert {
t.Errorf("Expected default clientCert = %s, got %s", expected.clientCert, cc)
}
ck := ClientKey()
if ck != expected.clientKey {
t.Errorf("Expected default clientKey = %s, got %s", expected.clientKey, ck)
}
cd := ConfigDir()
if cd != expected.configDir {
t.Errorf("Expected default configDir = %s, got %s", expected.configDir, cd)
}
en := EtcdNodes()
if en[0] != expected.etcdNodes[0] {
t.Errorf("Expected default etcdNodes = %v, got %v", expected.etcdNodes, en)
}
i := Interval()
if i != expected.interval {
t.Errorf("Expected default interval = %d, got %d", expected.interval, i)
}
p := Prefix()
if p != expected.prefix {
t.Errorf("Expected default prefix = %s, got %s", expected.prefix, p)
}
td := TemplateDir()
if td != expected.templateDir {
t.Errorf("Expected default templateDir = %s, got %s", expected.templateDir, td)
}
}