Update lua configuration_data when number of controller pod change

This commit is contained in:
Maxime Ginters 2018-11-27 09:53:51 -05:00
parent 55b4f00368
commit f90881b367
10 changed files with 113 additions and 19 deletions

View file

@ -205,8 +205,9 @@ func TestConfigureDynamically(t *testing.T) {
}}
commonConfig := &ingress.Configuration{
Backends: backends,
Servers: servers,
Backends: backends,
Servers: servers,
ControllerPodsCount: 2,
}
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@ -221,12 +222,26 @@ func TestConfigureDynamically(t *testing.T) {
t.Fatal(err)
}
body := string(b)
if strings.Contains(body, "target") {
t.Errorf("unexpected target reference in JSON content: %v", body)
}
if !strings.Contains(body, "service") {
t.Errorf("service reference should be present in JSON content: %v", body)
switch r.URL.Path {
case "/configuration/backends":
{
if strings.Contains(body, "target") {
t.Errorf("unexpected target reference in JSON content: %v", body)
}
if !strings.Contains(body, "service") {
t.Errorf("service reference should be present in JSON content: %v", body)
}
}
case "/configuration/general":
{
if !strings.Contains(body, "controllerPodsCount") {
t.Errorf("controllerPodsCount should be present in JSON content: %v", body)
}
}
default:
t.Errorf("unknown request to %s", r.URL.Path)
}
}))