(t *testing.T)
| 248 | } |
| 249 | |
| 250 | func TestApplyConfig(t *testing.T) { |
| 251 | proxy, err := newConfiguredProxy(goodCfg) |
| 252 | if err != nil { |
| 253 | t.Fatalf("unexpected error: %s", err) |
| 254 | } |
| 255 | if err = proxy.applyConfig(badCfg); err == nil { |
| 256 | t.Fatalf("error expected; got nil") |
| 257 | } |
| 258 | if _, ok := proxy.clusters["badCfg"]; ok { |
| 259 | t.Fatalf("bad config applied; expected previous config") |
| 260 | } |
| 261 | if err := proxy.applyConfig(badCfgWithNoHeartBeatUser); err == nil { |
| 262 | t.Fatalf("error expected; got nil") |
| 263 | } else if err.Error() != "`cluster.heartbeat.user ` cannot be unset for \"badCfgWithNoHeartBeatUser\" because a wildcarded user cannot send heartbeat" { |
| 264 | t.Fatalf("unexpected error %s", err.Error()) |
| 265 | } |
| 266 | if _, ok := proxy.clusters["badCfgWithNoHeartBeatUser"]; ok { |
| 267 | t.Fatalf("bad config applied; expected previous config") |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | var authCfg = &config.Config{ |
| 272 | Clusters: []config.Cluster{ |
nothing calls this directly
no test coverage detected