mirror of
https://git.vectorsigma.ru/public/k3s.git
synced 2026-07-28 21:49:29 +00:00
e2e: Fix curl test timeouts
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
committed by
Brad Davidson
parent
2b6225eeff
commit
67cbe75c84
@@ -105,7 +105,7 @@ var _ = Describe("Verify DualStack Configuration", Ordered, func() {
|
||||
if !strings.HasPrefix(pod.Name, "ds-clusterip-pod") {
|
||||
continue
|
||||
}
|
||||
cmd := fmt.Sprintf("curl -L --insecure http://%s", ip)
|
||||
cmd := fmt.Sprintf("curl -m 5 -s -f http://%s", ip)
|
||||
Eventually(func() (string, error) {
|
||||
return tc.Servers[0].RunCmdOnNode(cmd)
|
||||
}, "60s", "5s").Should(ContainSubstring("Welcome to nginx!"), "failed cmd: "+cmd)
|
||||
@@ -121,11 +121,11 @@ var _ = Describe("Verify DualStack Configuration", Ordered, func() {
|
||||
nodeIPs, err := e2e.GetNodeIPs(tc.KubeconfigFile)
|
||||
Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd)
|
||||
for _, node := range nodeIPs {
|
||||
cmd := fmt.Sprintf("curl --header host:%s http://%s/name.html", hostName, node.IPv4)
|
||||
cmd := fmt.Sprintf("curl --header host:%s -m 5 -s -f http://%s/name.html", hostName, node.IPv4)
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "10s", "2s").Should(ContainSubstring("ds-clusterip-pod"), "failed cmd: "+cmd)
|
||||
cmd = fmt.Sprintf("curl --header host:%s http://[%s]/name.html", hostName, node.IPv6)
|
||||
cmd = fmt.Sprintf("curl --header host:%s -m 5 -s -f http://[%s]/name.html", hostName, node.IPv6)
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "5s", "1s").Should(ContainSubstring("ds-clusterip-pod"), "failed cmd: "+cmd)
|
||||
@@ -141,11 +141,11 @@ var _ = Describe("Verify DualStack Configuration", Ordered, func() {
|
||||
nodeIPs, err := e2e.GetNodeIPs(tc.KubeconfigFile)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
for _, node := range nodeIPs {
|
||||
cmd = "curl -L --insecure http://" + node.IPv4 + ":" + nodeport + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + node.IPv4 + ":" + nodeport + "/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "10s", "1s").Should(ContainSubstring("ds-nodeport-pod"), "failed cmd: "+cmd)
|
||||
cmd = "curl -L --insecure http://[" + node.IPv6 + "]:" + nodeport + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://[" + node.IPv6 + "]:" + nodeport + "/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "10s", "1s").Should(ContainSubstring("ds-nodeport-pod"), "failed cmd: "+cmd)
|
||||
@@ -154,13 +154,13 @@ var _ = Describe("Verify DualStack Configuration", Ordered, func() {
|
||||
It("Verifies podSelector Network Policy", func() {
|
||||
_, err := tc.DeployWorkload("pod_client.yaml")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
cmd := "kubectl exec svc/client-curl -- curl -m7 ds-clusterip-svc/name.html"
|
||||
cmd := "kubectl exec svc/client-curl -- curl -m 5 -s -f http://ds-clusterip-svc/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "20s", "3s").Should(ContainSubstring("ds-clusterip-pod"), "failed cmd: "+cmd)
|
||||
_, err = tc.DeployWorkload("netpol-fail.yaml")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
cmd = "kubectl exec svc/client-curl -- curl -m7 ds-clusterip-svc/name.html"
|
||||
cmd = "kubectl exec svc/client-curl -- curl -m 5 -s -f http://ds-clusterip-svc/name.html"
|
||||
Eventually(func() error {
|
||||
_, err = e2e.RunCommand(cmd)
|
||||
Expect(err).To(HaveOccurred())
|
||||
@@ -168,7 +168,7 @@ var _ = Describe("Verify DualStack Configuration", Ordered, func() {
|
||||
}, "20s", "3s")
|
||||
_, err = tc.DeployWorkload("netpol-work.yaml")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
cmd = "kubectl exec svc/client-curl -- curl -m7 ds-clusterip-svc/name.html"
|
||||
cmd = "kubectl exec svc/client-curl -- curl -m 5 -s -f http://ds-clusterip-svc/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "20s", "3s").Should(ContainSubstring("ds-clusterip-pod"), "failed cmd: "+cmd)
|
||||
|
||||
@@ -127,7 +127,7 @@ var _ = Describe("Verify External-IP config", Ordered, func() {
|
||||
clientIPs, err := getClientIPs(tc.KubeconfigFile)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
for _, ip := range clientIPs {
|
||||
cmd := "kubectl exec svc/client-curl -- curl -m7 " + ip.IPv4 + "/name.html"
|
||||
cmd := "kubectl exec svc/client-curl -- curl -m 5 -s -f http://" + ip.IPv4 + "/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "20s", "3s").Should(ContainSubstring("client-deployment"), "failed cmd: "+cmd)
|
||||
|
||||
@@ -123,7 +123,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
g.Expect(string(pod.Status.Phase)).Should(Equal("Running"))
|
||||
}, "60s", "5s").Should(Succeed())
|
||||
|
||||
cmd := "curl " + pod.Status.PodIP
|
||||
cmd := "curl -m 5 -s -f http://" + pod.Status.PodIP
|
||||
Expect(tc.Servers[0].RunCmdOnNode(cmd)).To(ContainSubstring("Welcome to nginx!"))
|
||||
})
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
}, "240s", "5s").Should(ContainSubstring("test-clusterip"), "failed cmd: "+cmd)
|
||||
|
||||
clusterip, _ := e2e.FetchClusterIP(tc.KubeconfigFile, "nginx-clusterip-svc", false)
|
||||
cmd = "curl -L --insecure http://" + clusterip + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + clusterip + "/name.html"
|
||||
for _, node := range cpNodes {
|
||||
Eventually(func() (string, error) {
|
||||
return node.RunCmdOnNode(cmd)
|
||||
@@ -198,7 +198,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-nodeport"), "nodeport pod was not created")
|
||||
|
||||
cmd = "curl -L --insecure http://" + nodeExternalIP + ":" + nodeport + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + nodeExternalIP + ":" + nodeport + "/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-nodeport"), "failed cmd: "+cmd)
|
||||
@@ -221,7 +221,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"), "failed cmd: "+cmd)
|
||||
|
||||
cmd = "curl -L --insecure http://" + ip + ":" + port + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + ip + ":" + port + "/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"), "failed cmd: "+cmd)
|
||||
@@ -234,7 +234,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
|
||||
for _, node := range cpNodes {
|
||||
ip, _ := node.FetchNodeExternalIP()
|
||||
cmd := "curl --header host:foo1.bar.com" + " http://" + ip + "/name.html"
|
||||
cmd := "curl --header host:foo1.bar.com -m 5 -s -f http://" + ip + "/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-ingress"), "failed cmd: "+cmd)
|
||||
|
||||
@@ -132,14 +132,14 @@ var _ = Describe("Verify Services Traffic policies and firewall config", Ordered
|
||||
// Verify connectivity to the external IP of the lbsvc service and the IP should be the flannel interface IP because of MASQ
|
||||
for _, externalIP := range lbSvcExternalIPs {
|
||||
Eventually(func() (string, error) {
|
||||
cmd := "curl -s " + externalIP + ":81/ip"
|
||||
cmd := "curl -m 5 -s -f http://" + externalIP + ":81/ip"
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "25s", "5s").Should(ContainSubstring("10.42"))
|
||||
}
|
||||
|
||||
// Verify connectivity to the external IP of the lbsvcExt service and the IP should not be the flannel interface IP
|
||||
Eventually(func() (string, error) {
|
||||
cmd := "curl -s " + lbSvcExtExternalIPs[0] + ":82/ip"
|
||||
cmd := "curl -m 5 -s -f http://" + lbSvcExtExternalIPs[0] + ":82/ip"
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "25s", "5s").ShouldNot(ContainSubstring("10.42"))
|
||||
|
||||
@@ -150,7 +150,7 @@ var _ = Describe("Verify Services Traffic policies and firewall config", Ordered
|
||||
continue
|
||||
}
|
||||
Eventually(func() error {
|
||||
cmd := "curl -s --max-time 5 " + externalIP + ":82/ip"
|
||||
cmd := "curl -m 5 -s -f http://" + externalIP + ":82/ip"
|
||||
_, err := e2e.RunCommand(cmd)
|
||||
return err
|
||||
}, "40s", "5s").Should(MatchError(ContainSubstring("exit status")))
|
||||
@@ -221,12 +221,12 @@ var _ = Describe("Verify Services Traffic policies and firewall config", Ordered
|
||||
|
||||
var workingCmd, nonWorkingCmd string
|
||||
if serverNodeName == clientPod1Node {
|
||||
workingCmd = "kubectl exec " + clientPod1 + " -- curl -s --max-time 5 nginx-loadbalancer-svc-int:83/ip"
|
||||
nonWorkingCmd = "kubectl exec " + clientPod2 + " -- curl -s --max-time 5 nginx-loadbalancer-svc-int:83/ip"
|
||||
workingCmd = "kubectl exec " + clientPod1 + " -- curl -m 5 -s -f http://nginx-loadbalancer-svc-int:83/ip"
|
||||
nonWorkingCmd = "kubectl exec " + clientPod2 + " -- curl -m 5 -s -f http://nginx-loadbalancer-svc-int:83/ip"
|
||||
}
|
||||
if serverNodeName == clientPod2Node {
|
||||
workingCmd = "kubectl exec " + clientPod2 + " -- curl -s --max-time 5 nginx-loadbalancer-svc-int:83/ip"
|
||||
nonWorkingCmd = "kubectl exec " + clientPod1 + " -- curl -s --max-time 5 nginx-loadbalancer-svc-int:83/ip"
|
||||
workingCmd = "kubectl exec " + clientPod2 + " -- curl -m 5 -s -f http://nginx-loadbalancer-svc-int:83/ip"
|
||||
nonWorkingCmd = "kubectl exec " + clientPod1 + " -- curl -m 5 -s -f http://nginx-loadbalancer-svc-int:83/ip"
|
||||
}
|
||||
|
||||
Eventually(func() (string, error) {
|
||||
@@ -249,7 +249,7 @@ var _ = Describe("Verify Services Traffic policies and firewall config", Ordered
|
||||
|
||||
// curling a service with internal traffic policy=cluster. It should work on both pods
|
||||
for _, pod := range []string{clientPod1, clientPod2} {
|
||||
cmd := "kubectl exec " + pod + " -- curl -s --max-time 5 nginx-loadbalancer-svc:81/ip"
|
||||
cmd := "kubectl exec " + pod + " -- curl -m 5 -s -f http://nginx-loadbalancer-svc:81/ip"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "20s", "5s").Should(SatisfyAny(
|
||||
@@ -328,13 +328,13 @@ selector:
|
||||
|
||||
// Verify connectivity from nodes[0] works because we passed its IP to the loadBalancerSourceRanges
|
||||
Eventually(func() (string, error) {
|
||||
cmd := "curl -s --max-time 5 " + node.InternalIP + ":82"
|
||||
cmd := "curl -m 5 -s -f http://" + node.InternalIP + ":82"
|
||||
return sNode.RunCmdOnNode(cmd)
|
||||
}, "40s", "5s").Should(ContainSubstring("Welcome to nginx"))
|
||||
|
||||
// Verify connectivity from nodes[1] fails because we did not pass its IP to the loadBalancerSourceRanges
|
||||
Eventually(func(g Gomega) error {
|
||||
cmd := "curl -s --max-time 5 " + node.InternalIP + ":82"
|
||||
cmd := "curl -m 5 -s -f http:// " + node.InternalIP + ":82"
|
||||
_, err := aNode.RunCmdOnNode(cmd)
|
||||
return err
|
||||
}, "40s", "5s").Should(MatchError(ContainSubstring("exit status")))
|
||||
|
||||
@@ -80,7 +80,7 @@ var _ = Describe("Verify Upgrade", Ordered, func() {
|
||||
}, "240s", "5s").Should(ContainSubstring("test-clusterip"), "failed cmd: "+cmd)
|
||||
|
||||
clusterip, _ := e2e.FetchClusterIP(tc.KubeconfigFile, "nginx-clusterip-svc", false)
|
||||
cmd = "curl -L --insecure http://" + clusterip + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + clusterip + "/name.html"
|
||||
for _, node := range tc.Servers {
|
||||
Eventually(func() (string, error) {
|
||||
return node.RunCmdOnNode(cmd)
|
||||
@@ -103,7 +103,7 @@ var _ = Describe("Verify Upgrade", Ordered, func() {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-nodeport"), "nodeport pod was not created")
|
||||
|
||||
cmd = "curl -L --insecure http://" + nodeExternalIP + ":" + nodeport + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + nodeExternalIP + ":" + nodeport + "/name.html"
|
||||
fmt.Println(cmd)
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
@@ -125,7 +125,7 @@ var _ = Describe("Verify Upgrade", Ordered, func() {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"))
|
||||
|
||||
cmd = "curl -L --insecure http://" + ip + ":" + port + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + ip + ":" + port + "/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"), "failed cmd: "+cmd)
|
||||
@@ -138,7 +138,7 @@ var _ = Describe("Verify Upgrade", Ordered, func() {
|
||||
|
||||
for _, node := range tc.Servers {
|
||||
ip, _ := node.FetchNodeExternalIP()
|
||||
cmd := "curl --header host:foo1.bar.com" + " http://" + ip + "/name.html"
|
||||
cmd := "curl --header host:foo1.bar.com -m 5 -s -f http://" + ip + "/name.html"
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-ingress"), "failed cmd: "+cmd)
|
||||
@@ -260,7 +260,7 @@ var _ = Describe("Verify Upgrade", Ordered, func() {
|
||||
}, "420s", "5s").Should(ContainSubstring("test-clusterip"))
|
||||
|
||||
clusterip, _ := e2e.FetchClusterIP(tc.KubeconfigFile, "nginx-clusterip-svc", false)
|
||||
cmd := "curl -L --insecure http://" + clusterip + "/name.html"
|
||||
cmd := "curl -m 5 -s -f http://" + clusterip + "/name.html"
|
||||
fmt.Println(cmd)
|
||||
for _, node := range tc.Servers {
|
||||
Eventually(func() (string, error) {
|
||||
@@ -282,7 +282,7 @@ var _ = Describe("Verify Upgrade", Ordered, func() {
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-nodeport"), "nodeport pod was not created")
|
||||
|
||||
cmd = "curl -L --insecure http://" + nodeExternalIP + ":" + nodeport + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + nodeExternalIP + ":" + nodeport + "/name.html"
|
||||
fmt.Println(cmd)
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
@@ -297,7 +297,7 @@ var _ = Describe("Verify Upgrade", Ordered, func() {
|
||||
port, err := e2e.RunCommand(cmd)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Eventually(func() (string, error) {
|
||||
cmd := "curl -L --insecure http://" + ip + ":" + port + "/name.html"
|
||||
cmd := "curl -m 5 -s -f http://" + ip + ":" + port + "/name.html"
|
||||
return e2e.RunCommand(cmd)
|
||||
}, "240s", "5s").Should(ContainSubstring("test-loadbalancer"))
|
||||
|
||||
@@ -311,7 +311,7 @@ var _ = Describe("Verify Upgrade", Ordered, func() {
|
||||
It("After upgrade verifies Ingress", func() {
|
||||
for _, node := range tc.Servers {
|
||||
ip, _ := node.FetchNodeExternalIP()
|
||||
cmd := "curl --header host:foo1.bar.com" + " http://" + ip + "/name.html"
|
||||
cmd := "curl --header host:foo1.bar.com -m 5 -s -f http://" + ip + "/name.html"
|
||||
fmt.Println(cmd)
|
||||
|
||||
Eventually(func() (string, error) {
|
||||
|
||||
@@ -86,7 +86,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
}, "240s", "5s").Should(Succeed())
|
||||
|
||||
clusterip, _ := e2e.FetchClusterIP(tc.KubeconfigFile, "nginx-clusterip-svc", false)
|
||||
cmd := "curl -L --insecure http://" + clusterip + "/name.html"
|
||||
cmd := "curl -m 5 -s -f http://" + clusterip + "/name.html"
|
||||
for _, node := range tc.Servers {
|
||||
Eventually(func(g Gomega) {
|
||||
res, err := node.RunCmdOnNode(cmd)
|
||||
@@ -113,7 +113,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
g.Expect(res).Should(ContainSubstring("test-nodeport"), "nodeport pod was not created")
|
||||
}, "240s", "5s").Should(Succeed())
|
||||
|
||||
cmd = "curl -L --insecure http://" + nodeExternalIP + ":" + nodeport + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + nodeExternalIP + ":" + nodeport + "/name.html"
|
||||
|
||||
Eventually(func(g Gomega) {
|
||||
res, err := e2e.RunCommand(cmd)
|
||||
@@ -142,7 +142,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
}, "240s", "5s").Should(Succeed())
|
||||
|
||||
Eventually(func(g Gomega) {
|
||||
cmd = "curl -L --insecure http://" + ip + ":" + port + "/name.html"
|
||||
cmd = "curl -m 5 -s -f http://" + ip + ":" + port + "/name.html"
|
||||
res, err := e2e.RunCommand(cmd)
|
||||
g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res)
|
||||
g.Expect(res).Should(ContainSubstring("test-loadbalancer"))
|
||||
@@ -156,7 +156,7 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||
|
||||
for _, node := range tc.Servers {
|
||||
ip, _ := node.FetchNodeExternalIP()
|
||||
cmd := "curl --header host:foo1.bar.com" + " http://" + ip + "/name.html"
|
||||
cmd := "curl --header host:foo1.bar.com -m 5 -s -f http://" + ip + "/name.html"
|
||||
fmt.Println(cmd)
|
||||
|
||||
Eventually(func(g Gomega) {
|
||||
|
||||
@@ -109,7 +109,7 @@ var _ = Describe("Verify K3s can run Wasm workloads", Ordered, func() {
|
||||
for _, endpoint := range endpoints {
|
||||
url := fmt.Sprintf("http://%s/%s", ingressIPs[0], endpoint)
|
||||
fmt.Printf("Connecting to Wasm web application at: %s\n", url)
|
||||
cmd := "curl -sfv " + url
|
||||
cmd := "curl -m 5 -s -f -v " + url
|
||||
|
||||
Eventually(func() (string, error) {
|
||||
return e2e.RunCommand(cmd)
|
||||
|
||||
Reference in New Issue
Block a user