[e2e, service] Add total timeout for affinity check curl command.

Not setting a total timeout for curl may result in hanging command if
the connection succeeded, but the data transfer did not.

Signed-off-by: Nadia Pinaeva <n.m.pinaeva@gmail.com>
This commit is contained in:
Nadia Pinaeva 2024-12-02 11:55:05 +01:00
parent 810e9e212e
commit 326c84a151

View File

@ -142,7 +142,7 @@ func affinityCheckFromPod(execPod *v1.Pod, serviceIP string, servicePort int) (t
interval := 2 * AffinityConfirmCount * time.Second
serviceIPPort := net.JoinHostPort(serviceIP, strconv.Itoa(servicePort))
curl := fmt.Sprintf(`curl -q -s --connect-timeout 2 http://%s/`, serviceIPPort)
curl := fmt.Sprintf(`curl -q -s --connect-timeout 2 --max-time 60 http://%s/`, serviceIPPort)
cmd := fmt.Sprintf("for i in $(seq 0 %d); do echo; %s ; done", AffinityConfirmCount, curl)
getHosts := func() []string {
stdout, err := e2eoutput.RunHostCmd(execPod.Namespace, execPod.Name, cmd)