Merge pull request #464 from bmcstdio/bmcstdio/fix-get-pod-status

mock: do not panic on unknown pods
This commit is contained in:
Paulo Pires
2018-12-12 12:24:28 +00:00
committed by GitHub

View File

@@ -190,8 +190,7 @@ func (p *MockProvider) GetPod(ctx context.Context, namespace, name string) (pod
if pod, ok := p.pods[key]; ok {
return pod, nil
}
return nil, nil
return nil, strongerrors.NotFound(fmt.Errorf("pod \"%s/%s\" is not known to the provider", namespace, name))
}
// GetContainerLogs retrieves the logs of a container by name from the provider.
@@ -255,7 +254,7 @@ func (p *MockProvider) GetPodStatus(ctx context.Context, namespace, name string)
pod, err := p.GetPod(ctx, namespace, name)
if err != nil {
return status, err
return nil, err
}
for _, container := range pod.Spec.Containers {