Merge pull request #34053 from bprashanth/trim_string

Automatic merge from submit-queue

Check for empty string post trimming

We curl in a retry loop and timeout,  trimming stdout to find endpoint names. When curl hits the timeout, stdout is empty, so we insert the empty string into the received set of endpoints. 

Fixes https://github.com/kubernetes/kubernetes/issues/32684
This commit is contained in:
Kubernetes Submit Queue 2016-10-05 02:32:41 -07:00 committed by GitHub
commit 0331b27f45

View File

@ -170,7 +170,10 @@ func (config *NetworkingTestConfig) dialFromContainer(protocol, containerIP, tar
continue continue
} }
for _, hostName := range output["responses"] { for _, hostName := range output["responses"] {
eps.Insert(hostName) trimmed := strings.TrimSpace(hostName)
if trimmed != "" {
eps.Insert(trimmed)
}
} }
} }
framework.Logf("Waiting for endpoints: %v", expectedEps.Difference(eps)) framework.Logf("Waiting for endpoints: %v", expectedEps.Difference(eps))
@ -217,7 +220,10 @@ func (config *NetworkingTestConfig) dialFromNode(protocol, targetIP string, targ
// we confirm unreachability. // we confirm unreachability.
framework.Logf("Failed to execute %v: %v", filterCmd, err) framework.Logf("Failed to execute %v: %v", filterCmd, err)
} else { } else {
eps.Insert(strings.TrimSpace(stdout)) trimmed := strings.TrimSpace(stdout)
if trimmed != "" {
eps.Insert(trimmed)
}
} }
framework.Logf("Waiting for %+v endpoints, got endpoints %+v", expectedEps.Difference(eps), eps) framework.Logf("Waiting for %+v endpoints, got endpoints %+v", expectedEps.Difference(eps), eps)