Add retries to GetPod calls. (#1420)
parent
e37c87ae4f
commit
c9bb006283
|
|
@ -47,7 +47,11 @@ func testClusterDNS(t *testing.T) {
|
|||
|
||||
p := &api.Pod{}
|
||||
for p.Status.Phase != "Running" {
|
||||
p = kubectlRunner.GetPod(podName, podNamespace)
|
||||
var err error
|
||||
p, err = kubectlRunner.GetPod(podName, podNamespace)
|
||||
if err != nil {
|
||||
return &commonutil.RetriableError{Err: err}
|
||||
}
|
||||
}
|
||||
|
||||
dnsByteArr, err := kubectlRunner.RunCommand([]string{"exec", podName, "--namespace=" + podNamespace,
|
||||
|
|
|
|||
|
|
@ -70,7 +70,10 @@ func testMounting(t *testing.T) {
|
|||
|
||||
p := &api.Pod{}
|
||||
for p.Status.Phase != "Running" {
|
||||
p = kubectlRunner.GetPod(podName, "default")
|
||||
p, err = kubectlRunner.GetPod(podName, "default")
|
||||
if err != nil {
|
||||
return &commonutil.RetriableError{Err: err}
|
||||
}
|
||||
}
|
||||
|
||||
path := filepath.Join(tempDir, "frompod")
|
||||
|
|
|
|||
|
|
@ -47,7 +47,10 @@ func TestPersistence(t *testing.T) {
|
|||
}
|
||||
|
||||
checkPod := func() error {
|
||||
p := kubectlRunner.GetPod(podName, podNamespace)
|
||||
p, err := kubectlRunner.GetPod(podName, podNamespace)
|
||||
if err != nil {
|
||||
return &commonutil.RetriableError{Err: err}
|
||||
}
|
||||
if kubectlRunner.IsPodReady(p) {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,10 +202,8 @@ func (k *KubectlRunner) DeleteNamespace(namespace string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func (k *KubectlRunner) GetPod(name, namespace string) *api.Pod {
|
||||
func (k *KubectlRunner) GetPod(name, namespace string) (*api.Pod, error) {
|
||||
p := &api.Pod{}
|
||||
if err := k.RunCommandParseOutput([]string{"get", "pod", name, "--namespace=" + namespace}, p); err != nil {
|
||||
k.T.Fatalf("Error checking pod status: %s", err)
|
||||
}
|
||||
return p
|
||||
err := k.RunCommandParseOutput([]string{"get", "pod", name, "--namespace=" + namespace}, p)
|
||||
return p, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue