You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2018/05/18 16:42:00 UTC
[incubator-trafficcontrol] branch master updated: fix
config_test.go to keep it up to date with changes to LoadConfig
This is an automated email from the ASF dual-hosted git repository.
dewrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new e07d073 fix config_test.go to keep it up to date with changes to LoadConfig
e07d073 is described below
commit e07d0733da4ffef1eddcb6adb2054b9db64d7d9a
Author: Dylan Volz <Dy...@comcast.com>
AuthorDate: Fri May 18 10:30:40 2018 -0600
fix config_test.go to keep it up to date with changes to LoadConfig
---
.../traffic_ops_golang/config/config_test.go | 35 +++++++++++++++-------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/traffic_ops/traffic_ops_golang/config/config_test.go b/traffic_ops/traffic_ops_golang/config/config_test.go
index 1bd73d6..f20763d 100644
--- a/traffic_ops/traffic_ops_golang/config/config_test.go
+++ b/traffic_ops/traffic_ops_golang/config/config_test.go
@@ -196,38 +196,53 @@ func TestLoadConfig(t *testing.T) {
defer os.Remove(goodRiakCfg) // clean up
// test bad paths
- _, err = LoadConfig(badPath, badPath, badPath, version)
+ _, errs, blockStartup := LoadConfig(badPath, badPath, badPath, version)
exp = fmt.Sprintf("reading CDN conf '%s'", badPath)
- if !strings.HasPrefix(err.Error(), exp) {
+ if !strings.HasPrefix(errs[0].Error(), exp) {
t.Error("expected", exp, "got", err)
}
+ if blockStartup != true {
+ t.Error("expected blockStartup to be true but it was ", blockStartup)
+ }
// bad json in cdn.conf
- _, err = LoadConfig(badCfg, badCfg, badPath, version)
+ _, errs, blockStartup = LoadConfig(badCfg, badCfg, badPath, version)
exp = fmt.Sprintf("unmarshalling '%s'", badCfg)
- if !strings.HasPrefix(err.Error(), exp) {
+ if !strings.HasPrefix(errs[0].Error(), exp) {
t.Error("expected", exp, "got", err)
}
+ if blockStartup != true {
+ t.Error("expected blockStartup to be true but it was ", blockStartup)
+ }
// good cdn.conf, bad db conf
- _, err = LoadConfig(goodCfg, badPath, badPath, version)
+ _, errs, blockStartup = LoadConfig(goodCfg, badPath, badPath, version)
exp = fmt.Sprintf("reading db conf '%s'", badPath)
- if !strings.HasPrefix(err.Error(), exp) {
+ if !strings.HasPrefix(errs[0].Error(), exp) {
t.Error("expected", exp, "got", err)
}
+ if blockStartup != true {
+ t.Error("expected blockStartup to be true but it was ", blockStartup)
+ }
// good cdn.conf, bad json in database.conf
- _, err = LoadConfig(goodCfg, badCfg, badPath, version)
+ _, errs, blockStartup = LoadConfig(goodCfg, badCfg, badPath, version)
exp = fmt.Sprintf("unmarshalling '%s'", badCfg)
- if !strings.HasPrefix(err.Error(), exp) {
+ if !strings.HasPrefix(errs[0].Error(), exp) {
t.Error("expected", exp, "got", err)
}
+ if blockStartup != true {
+ t.Error("expected blockStartup to be true but it was ", blockStartup)
+ }
// good cdn.conf, good database.conf
- cfg, err = LoadConfig(goodCfg, goodDbCfg, goodRiakCfg, version)
- if err != nil {
+ cfg, errs, blockStartup = LoadConfig(goodCfg, goodDbCfg, goodRiakCfg, version)
+ if len(errs) != 0 {
t.Error("Good config -- unexpected error ", err)
}
+ if blockStartup != false {
+ t.Error("expected blockStartup to be false but it was ", blockStartup)
+ }
expectedRiak := riak.AuthOptions{User: "riakuser", Password: "password", TlsConfig: &tls.Config{InsecureSkipVerify: true}}
--
To stop receiving notification emails like this one, please contact
dewrich@apache.org.