mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
return not-found errors properly from fake listeres
Signed-off-by: utam0k <k0ma@utam0k.jp>
This commit is contained in:
parent
46f4248d56
commit
aba817ac1d
@ -495,7 +495,7 @@ func TestCSILimits(t *testing.T) {
|
||||
ephemeralEnabled: true,
|
||||
driverNames: []string{ebsCSIDriverName},
|
||||
test: "ephemeral volume missing",
|
||||
wantStatus: framework.AsStatus(errors.New(`looking up PVC test/abc-xyz: persistentvolumeclaim "abc-xyz" not found`)),
|
||||
wantStatus: framework.AsStatus(errors.New(`looking up PVC test/abc-xyz: persistentvolumeclaims "abc-xyz" not found`)),
|
||||
},
|
||||
{
|
||||
newPod: ephemeralVolumePod,
|
||||
@ -595,7 +595,7 @@ func TestCSILimits(t *testing.T) {
|
||||
ephemeralEnabled: true,
|
||||
driverNames: []string{ebsCSIDriverName},
|
||||
test: "don't skip Filter when the pod has ephemeral volumes",
|
||||
wantStatus: framework.AsStatus(errors.New(`looking up PVC test/abc-xyz: persistentvolumeclaim "abc-xyz" not found`)),
|
||||
wantStatus: framework.AsStatus(errors.New(`looking up PVC test/abc-xyz: persistentvolumeclaims "abc-xyz" not found`)),
|
||||
},
|
||||
{
|
||||
newPod: inlineMigratablePodWithConfigmapAndSecret,
|
||||
|
@ -139,7 +139,7 @@ func TestEphemeralLimits(t *testing.T) {
|
||||
newPod: ephemeralVolumePod,
|
||||
ephemeralEnabled: true,
|
||||
test: "volume missing",
|
||||
wantStatus: framework.AsStatus(errors.New(`looking up PVC test/abc-xyz: persistentvolumeclaim "abc-xyz" not found`)),
|
||||
wantStatus: framework.AsStatus(errors.New(`looking up PVC test/abc-xyz: persistentvolumeclaims "abc-xyz" not found`)),
|
||||
},
|
||||
{
|
||||
newPod: ephemeralVolumePod,
|
||||
|
@ -494,9 +494,9 @@ func TestWithBinding(t *testing.T) {
|
||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_NoSC"),
|
||||
Node: testNode,
|
||||
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable,
|
||||
"unable to find storage class: Class_0"),
|
||||
`storageclasses.storage.k8s.io "Class_0" not found`),
|
||||
wantFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable,
|
||||
"unable to find storage class: Class_0"),
|
||||
`storageclasses.storage.k8s.io "Class_0" not found`),
|
||||
},
|
||||
{
|
||||
name: "unbound volume immediate binding mode",
|
||||
|
@ -195,7 +195,7 @@ func (f *persistentVolumeClaimNamespaceLister) Get(name string) (*v1.PersistentV
|
||||
return pvc, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("persistentvolumeclaim %q not found", name)
|
||||
return nil, errors.NewNotFound(v1.Resource("persistentvolumeclaims"), name)
|
||||
}
|
||||
|
||||
func (f persistentVolumeClaimNamespaceLister) List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) {
|
||||
@ -266,7 +266,7 @@ func (n CSINodeLister) Get(name string) (*storagev1.CSINode, error) {
|
||||
return &cn, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("csiNode %q not found", name)
|
||||
return nil, errors.NewNotFound(storagev1.Resource("csinodes"), name)
|
||||
}
|
||||
|
||||
// List lists all CSINodes in the indexer.
|
||||
@ -286,7 +286,7 @@ func (pvs PersistentVolumeLister) Get(pvID string) (*v1.PersistentVolume, error)
|
||||
return &pv, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("unable to find persistent volume: %s", pvID)
|
||||
return nil, errors.NewNotFound(v1.Resource("persistentvolumes"), pvID)
|
||||
}
|
||||
|
||||
// List lists all PersistentVolumes in the indexer.
|
||||
@ -306,12 +306,7 @@ func (classes StorageClassLister) Get(name string) (*storagev1.StorageClass, err
|
||||
return &sc, nil
|
||||
}
|
||||
}
|
||||
return nil, &errors.StatusError{
|
||||
ErrStatus: metav1.Status{
|
||||
Reason: metav1.StatusReasonNotFound,
|
||||
Message: fmt.Sprintf("unable to find storage class: %s", name),
|
||||
},
|
||||
}
|
||||
return nil, errors.NewNotFound(storagev1.Resource("storageclasses"), name)
|
||||
}
|
||||
|
||||
// List lists all StorageClass in the indexer.
|
||||
|
Loading…
Reference in New Issue
Block a user