Merge pull request #464 from bmcstdio/bmcstdio/fix-get-pod-status
mock: do not panic on unknown pods
This commit is contained in:
@@ -190,8 +190,7 @@ func (p *MockProvider) GetPod(ctx context.Context, namespace, name string) (pod
|
|||||||
if pod, ok := p.pods[key]; ok {
|
if pod, ok := p.pods[key]; ok {
|
||||||
return pod, nil
|
return pod, nil
|
||||||
}
|
}
|
||||||
|
return nil, strongerrors.NotFound(fmt.Errorf("pod \"%s/%s\" is not known to the provider", namespace, name))
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContainerLogs retrieves the logs of a container by name from the provider.
|
// 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)
|
pod, err := p.GetPod(ctx, namespace, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return status, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, container := range pod.Spec.Containers {
|
for _, container := range pod.Spec.Containers {
|
||||||
|
|||||||
Reference in New Issue
Block a user