Merge pull request #46582 from m1093782566/fix-ipt-hard-code

Automatic merge from submit-queue (batch tested with PRs 49642, 50335, 50390, 49283, 46582)

fix iptables mode hard code in e2e test

Fixes #46078
pull/6/head
Kubernetes Submit Queue 2017-08-10 00:53:28 -07:00 committed by GitHub
commit 7ef5cc23d1
2 changed files with 16 additions and 2 deletions

View File

@ -279,9 +279,22 @@ func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targ
func (config *NetworkingTestConfig) GetSelfURL(port int32, path string, expected string) {
cmd := fmt.Sprintf("curl -i -q -s --connect-timeout 1 http://localhost:%d%s", port, path)
By(fmt.Sprintf("Getting kube-proxy self URL %s", path))
config.executeCurlCmd(cmd, expected)
}
// GetSelfStatusCode executes a curl against the given path via kubectl exec into a
// test container running with host networking, and fails if the returned status
// code doesn't match the expected string.
func (config *NetworkingTestConfig) GetSelfURLStatusCode(port int32, path string, expected string) {
// check status code
cmd := fmt.Sprintf("curl -o /dev/null -i -q -s -w %%{http_code} --connect-timeout 1 http://localhost:%d%s", port, path)
By(fmt.Sprintf("Checking status code against http://localhost:%d%s", port, path))
config.executeCurlCmd(cmd, expected)
}
func (config *NetworkingTestConfig) executeCurlCmd(cmd string, expected string) {
// These are arbitrary timeouts. The curl command should pass on first try,
// unless kubeproxy is starved/bootstrapping/restarting etc.
// unless remote server is starved/bootstrapping/restarting etc.
const retryInterval = 1 * time.Second
const retryTimeout = 30 * time.Second
podName := config.HostTestContainerPod.Name

View File

@ -87,7 +87,8 @@ var _ = SIGDescribe("Networking", func() {
config.GetSelfURL(ports.ProxyHealthzPort, "/healthz", "200 OK")
// Verify /healthz returns the proper content.
config.GetSelfURL(ports.ProxyHealthzPort, "/healthz", "lastUpdated")
config.GetSelfURL(ports.ProxyStatusPort, "/proxyMode", "iptables") // the default
// Verify /proxyMode returns http status code 200.
config.GetSelfURLStatusCode(ports.ProxyStatusPort, "/proxyMode", "200")
})
// TODO: Remove [Slow] when this has had enough bake time to prove presubmit worthiness.