test/e2e/scheduling:improve code

This commit is contained in:
tanjunchen 2020-04-08 18:03:15 +08:00
parent 7061dddf26
commit e358e75681
2 changed files with 2 additions and 2 deletions

View File

@ -288,11 +288,11 @@ func VerifyJobNCompletions(f *framework.Framework, completions int32) {
framework.Logf("Got the following pods for job cuda-add: %v", createdPodNames)
successes := int32(0)
regex := regexp.MustCompile("PASSED")
for _, podName := range createdPodNames {
f.PodClient().WaitForFinish(podName, 5*time.Minute)
logs, err := e2epod.GetPodLogs(f.ClientSet, ns, podName, "vector-addition")
framework.ExpectNoError(err, "Should be able to get logs for pod %v", podName)
regex := regexp.MustCompile("PASSED")
if regex.MatchString(logs) {
successes++
}

View File

@ -1039,7 +1039,7 @@ func createHostPortPodOnNode(f *framework.Framework, podName, ns, hostIP string,
// adding the well known prefix "0::ffff:" https://tools.ietf.org/html/rfc2765
// if the ip is IPv4 and the cluster IPFamily is IPv6, otherwise returns the same ip
func translateIPv4ToIPv6(ip string) string {
if framework.TestContext.IPFamily == "ipv6" && !k8utilnet.IsIPv6String(ip) && ip != "" {
if framework.TestContext.IPFamily == "ipv6" && ip != "" && !k8utilnet.IsIPv6String(ip) {
ip = "0::ffff:" + ip
}
return ip