forked from kelseyhightower/confd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37ea79c
commit d4807c9
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,54 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestInitConfig(t *testing.T) { | ||
var expected = struct { | ||
clientCert string | ||
clientKey string | ||
configDir string | ||
etcdNodes []string | ||
interval int | ||
onetime bool | ||
prefix string | ||
templateDir string | ||
}{ | ||
"", "", "/etc/confd/conf.d", []string{"http://127.0.0.1:4001"}, | ||
600, false, "/", "/etc/confd/templates", | ||
} | ||
InitConfig() | ||
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) | ||
} | ||
ot := Onetime() | ||
if ot != expected.onetime { | ||
t.Errorf("Expected default onetime = %v, got %v", expected.onetime, ot) | ||
} | ||
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) | ||
} | ||
} |