mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	do not assume backend on e2e service jig
This commit is contained in:
		@@ -902,24 +902,20 @@ func testEndpointReachability(endpoint string, port int32, protocol v1.Protocol,
 | 
				
			|||||||
	cmd := ""
 | 
						cmd := ""
 | 
				
			||||||
	switch protocol {
 | 
						switch protocol {
 | 
				
			||||||
	case v1.ProtocolTCP:
 | 
						case v1.ProtocolTCP:
 | 
				
			||||||
		cmd = fmt.Sprintf("echo hostName | nc -v -t -w 2 %s %v", endpoint, port)
 | 
							cmd = fmt.Sprintf("nc -v -z -w 2 %s %v", endpoint, port)
 | 
				
			||||||
	case v1.ProtocolUDP:
 | 
						case v1.ProtocolUDP:
 | 
				
			||||||
		cmd = fmt.Sprintf("echo hostName | nc -v -u -w 2 %s %v", endpoint, port)
 | 
							cmd = fmt.Sprintf("nc -v -z -u -w 2 %s %v", endpoint, port)
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return fmt.Errorf("service reachability check is not supported for %v", protocol)
 | 
							return fmt.Errorf("service reachability check is not supported for %v", protocol)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err := wait.PollImmediate(1*time.Second, ServiceReachabilityShortPollTimeout, func() (bool, error) {
 | 
						err := wait.PollImmediate(1*time.Second, ServiceReachabilityShortPollTimeout, func() (bool, error) {
 | 
				
			||||||
		stdout, err := framework.RunHostCmd(execPod.Namespace, execPod.Name, cmd)
 | 
							_, err := framework.RunHostCmd(execPod.Namespace, execPod.Name, cmd)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			framework.Logf("Service reachability failing with error: %v\nRetrying...", err)
 | 
								framework.Logf("Service reachability failing with error: %v\nRetrying...", err)
 | 
				
			||||||
			return false, nil
 | 
								return false, nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		trimmed := strings.TrimSpace(stdout)
 | 
					 | 
				
			||||||
		if trimmed != "" {
 | 
					 | 
				
			||||||
		return true, nil
 | 
							return true, nil
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return false, nil
 | 
					 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return fmt.Errorf("service is not reachable within %v timeout on endpoint %s over %s protocol", ServiceReachabilityShortPollTimeout, ep, protocol)
 | 
							return fmt.Errorf("service is not reachable within %v timeout on endpoint %s over %s protocol", ServiceReachabilityShortPollTimeout, ep, protocol)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user