MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / TestApplyConfig

Function TestApplyConfig

proxy_test.go:250–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

248}
249
250func 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
271var authCfg = &config.Config{
272 Clusters: []config.Cluster{

Callers

nothing calls this directly

Calls 3

newConfiguredProxyFunction · 0.85
applyConfigMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected