11package configuration
22
33import (
4- "testing"
54 . "github.com/onsi/gomega"
5+ "testing"
66
7- "github.com/miniclip/gonsul/tests/mocks "
7+ "fmt "
88 "github.com/miniclip/gonsul/errorutil"
99 "github.com/miniclip/gonsul/interfaces"
10- "fmt "
10+ "github.com/miniclip/gonsul/tests/mocks "
1111)
1212
1313func TestGetConfigSuccess(t *testing.T) {
@@ -34,6 +34,7 @@ func TestGetConfigSuccess(t *testing.T) {
3434 false,
3535 60,
3636 "json,txt,ini",
37+ 10,
3738 )
3839
3940 // Setup expectations
@@ -71,47 +72,47 @@ func TestGetConfigMultipleFail(t *testing.T) {
7172 }
7273}
7374
74-
7575func getMultipleWrongConfigs() []interfaces.ConfigFlags {
7676 return []interfaces.ConfigFlags{
77- getConfigFlagsFor("WRONG_LOG_LEVEL", StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-success.json", false, 60, "json,txt,ini"),
78- getConfigFlagsFor(errorutil.LogDebug, "WRONG_STRATEGY", "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-success.json", false, 60, "json,txt,ini"),
79- getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-success.json", false, 60, "json,txt,ini"),
80- getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "", "", false, "tests/test-secrets-file-success.json", false, 60, "json,txt,ini"),
81- getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-success.json", false, 60, ""),
82- getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-fail.json", false, 60, "json,txt,ini"),
83- getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-non-existent.json", false, 60, "json,txt,ini"),
77+ getConfigFlagsFor("WRONG_LOG_LEVEL", StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-success.json", false, 60, "json,txt,ini", 10 ),
78+ getConfigFlagsFor(errorutil.LogDebug, "WRONG_STRATEGY", "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-success.json", false, 60, "json,txt,ini", 10 ),
79+ getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-success.json", false, 60, "json,txt,ini", 10 ),
80+ getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "", "", false, "tests/test-secrets-file-success.json", false, 60, "json,txt,ini", 10 ),
81+ getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-success.json", false, 60, "", 10 ),
82+ getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-fail.json", false, 60, "json,txt,ini", 10 ),
83+ getConfigFlagsFor(errorutil.LogDebug, StrategyOnce, "", "", "", "", "", "/", "./..", "http://consul.com", "some-acl-1234567890-qwerty", "", false, "tests/test-secrets-file-non-existent.json", false, 60, "json,txt,ini", 10 ),
8484 }
8585}
8686
87-
8887func getConfigFlagsFor(
8988 ll, s, ru, rsk, rsu, rb, rrn, rbp, rr, cu, ca, cbp string,
9089 ej bool,
9190 sf string,
9291 ad bool,
9392 pi int,
9493 ie string,
94+ ti int,
9595) interfaces.ConfigFlags {
9696 configFlags := interfaces.ConfigFlags{
97- LogLevel: &ll,
98- Strategy: &s,
99- RepoURL: &ru,
100- RepoSSHKey: &rsk,
101- RepoSSHUser: &rsu,
102- RepoBranch: &rb,
103- RepoRemoteName: &rrn,
104- RepoBasePath: &rbp,
105- RepoRootDir: &rr,
106- ConsulURL: &cu,
107- ConsulACL: &ca,
108- ConsulBasePath: &cbp,
109- ExpandJSON: &ej,
110- SecretsFile: &sf,
111- AllowDeletes: &ad,
112- PollInterval: &pi,
97+ LogLevel: &ll,
98+ Strategy: &s,
99+ RepoURL: &ru,
100+ RepoSSHKey: &rsk,
101+ RepoSSHUser: &rsu,
102+ RepoBranch: &rb,
103+ RepoRemoteName: &rrn,
104+ RepoBasePath: &rbp,
105+ RepoRootDir: &rr,
106+ ConsulURL: &cu,
107+ ConsulACL: &ca,
108+ ConsulBasePath: &cbp,
109+ ExpandJSON: &ej,
110+ SecretsFile: &sf,
111+ AllowDeletes: &ad,
112+ PollInterval: &pi,
113113 ValidExtensions: &ie,
114+ Timeout: &ti,
114115 }
115116
116117 return configFlags
117- }
118+ }
0 commit comments