mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +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,
|
ephemeralEnabled: true,
|
||||||
driverNames: []string{ebsCSIDriverName},
|
driverNames: []string{ebsCSIDriverName},
|
||||||
test: "ephemeral volume missing",
|
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,
|
newPod: ephemeralVolumePod,
|
||||||
@ -595,7 +595,7 @@ func TestCSILimits(t *testing.T) {
|
|||||||
ephemeralEnabled: true,
|
ephemeralEnabled: true,
|
||||||
driverNames: []string{ebsCSIDriverName},
|
driverNames: []string{ebsCSIDriverName},
|
||||||
test: "don't skip Filter when the pod has ephemeral volumes",
|
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,
|
newPod: inlineMigratablePodWithConfigmapAndSecret,
|
||||||
|
@ -139,7 +139,7 @@ func TestEphemeralLimits(t *testing.T) {
|
|||||||
newPod: ephemeralVolumePod,
|
newPod: ephemeralVolumePod,
|
||||||
ephemeralEnabled: true,
|
ephemeralEnabled: true,
|
||||||
test: "volume missing",
|
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,
|
newPod: ephemeralVolumePod,
|
||||||
|
@ -494,9 +494,9 @@ func TestWithBinding(t *testing.T) {
|
|||||||
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_NoSC"),
|
Pod: createPodWithVolume("pod_1", "vol_1", "PVC_NoSC"),
|
||||||
Node: testNode,
|
Node: testNode,
|
||||||
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable,
|
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,
|
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",
|
name: "unbound volume immediate binding mode",
|
||||||
|
@ -195,7 +195,7 @@ func (f *persistentVolumeClaimNamespaceLister) Get(name string) (*v1.PersistentV
|
|||||||
return pvc, nil
|
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) {
|
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 &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.
|
// List lists all CSINodes in the indexer.
|
||||||
@ -286,7 +286,7 @@ func (pvs PersistentVolumeLister) Get(pvID string) (*v1.PersistentVolume, error)
|
|||||||
return &pv, nil
|
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.
|
// List lists all PersistentVolumes in the indexer.
|
||||||
@ -306,12 +306,7 @@ func (classes StorageClassLister) Get(name string) (*storagev1.StorageClass, err
|
|||||||
return &sc, nil
|
return &sc, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, &errors.StatusError{
|
return nil, errors.NewNotFound(storagev1.Resource("storageclasses"), name)
|
||||||
ErrStatus: metav1.Status{
|
|
||||||
Reason: metav1.StatusReasonNotFound,
|
|
||||||
Message: fmt.Sprintf("unable to find storage class: %s", name),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// List lists all StorageClass in the indexer.
|
// List lists all StorageClass in the indexer.
|
||||||
|
Loading…
Reference in New Issue
Block a user