mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
tests: Makes tests' commands platform agnostic
Some commands used in tests are Linux specific and do not exist or do not behave the same on Windows nodes. This can cause those tests to fail on Windows nodes. Replaces the mentioned commands with ones that behave the same on both Linux and Windows.
This commit is contained in:
parent
a29b093a56
commit
7cd4ebf3c3
@ -292,13 +292,13 @@ func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targ
|
|||||||
if protocol == "udp" {
|
if protocol == "udp" {
|
||||||
// TODO: It would be enough to pass 1s+epsilon to timeout, but unfortunately
|
// TODO: It would be enough to pass 1s+epsilon to timeout, but unfortunately
|
||||||
// busybox timeout doesn't support non-integer values.
|
// busybox timeout doesn't support non-integer values.
|
||||||
cmd = fmt.Sprintf("echo 'hostName' | timeout -t 2 nc -w 1 -u %s %d", targetIP, targetPort)
|
cmd = fmt.Sprintf("echo 'hostName' | nc -w 1 -u %s %d", targetIP, targetPort)
|
||||||
} else {
|
} else {
|
||||||
ipPort := net.JoinHostPort(targetIP, strconv.Itoa(targetPort))
|
ipPort := net.JoinHostPort(targetIP, strconv.Itoa(targetPort))
|
||||||
// The current versions of curl included in CentOS and RHEL distros
|
// The current versions of curl included in CentOS and RHEL distros
|
||||||
// misinterpret square brackets around IPv6 as globbing, so use the -g
|
// misinterpret square brackets around IPv6 as globbing, so use the -g
|
||||||
// argument to disable globbing to handle the IPv6 case.
|
// argument to disable globbing to handle the IPv6 case.
|
||||||
cmd = fmt.Sprintf("timeout -t 15 curl -g -q -s --connect-timeout 1 http://%s/hostName", ipPort)
|
cmd = fmt.Sprintf("curl -g -q -s --max-time 15 --connect-timeout 1 http://%s/hostName", ipPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This simply tells us that we can reach the endpoints. Check that
|
// TODO: This simply tells us that we can reach the endpoints. Check that
|
||||||
|
@ -560,7 +560,7 @@ func createNetworkClientPod(f *framework.Framework, namespace *v1.Namespace, pod
|
|||||||
Args: []string{
|
Args: []string{
|
||||||
"/bin/sh",
|
"/bin/sh",
|
||||||
"-c",
|
"-c",
|
||||||
fmt.Sprintf("for i in $(seq 1 5); do wget -T 8 %s.%s:%d -O - && exit 0 || sleep 1; done; exit 1",
|
fmt.Sprintf("for i in $(seq 1 5); do curl -s -m 8 %s.%s:%d && exit 0 || sleep 1; done; exit 1",
|
||||||
targetService.Name, targetService.Namespace, targetPort),
|
targetService.Name, targetService.Namespace, targetPort),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user