GetLbAlgorithm helper func for e2e

This commit is contained in:
Elvin Efendi 2019-07-02 23:50:30 -04:00
parent d3eb42b98b
commit 964a484b2f
2 changed files with 27 additions and 15 deletions

View file

@ -17,7 +17,6 @@ limitations under the License.
package loadbalance
import (
"encoding/json"
"strings"
"time"
@ -53,20 +52,8 @@ var _ = framework.IngressNginxDescribe("Load Balance - Configmap value", func()
})
time.Sleep(waitForLuaSync)
getCmd := "/dbg backends all"
output, err := f.ExecIngressPod(getCmd)
algorithm, err := f.GetLbAlgorithm("http-svc", 80)
Expect(err).Should(BeNil())
var backends []map[string]interface{}
unmarshalErr := json.Unmarshal([]byte(output), &backends)
Expect(unmarshalErr).Should(BeNil())
for _, backend := range backends {
if backend["name"].(string) != "upstream-default-backend" {
lb, ok := backend["load-balance"].(string)
Expect(ok).Should(Equal(true))
Expect(lb).Should(Equal("ewma"))
}
}
Expect(algorithm).Should(Equal("ewma"))
})
})