mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #31903 from screeley44/k8-validation-test
Automatic merge from submit-queue Add unit test for bad ReclaimPolicy and valid ReclaimPolicy in /pkg/api/validation unit tests for validation.go regarding PersistentVolumeReclaimPolicy (bad value and good value) see PR: #30304
This commit is contained in:
commit
fd52ae5215
@ -516,6 +516,19 @@ func TestValidatePersistentVolumes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
"good-volume-with-retain-policy": {
|
||||||
|
isExpectedFailure: false,
|
||||||
|
volume: testVolume("foo", "", api.PersistentVolumeSpec{
|
||||||
|
Capacity: api.ResourceList{
|
||||||
|
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
|
||||||
|
},
|
||||||
|
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
|
||||||
|
PersistentVolumeSource: api.PersistentVolumeSource{
|
||||||
|
HostPath: &api.HostPathVolumeSource{Path: "/foo"},
|
||||||
|
},
|
||||||
|
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimRetain,
|
||||||
|
}),
|
||||||
|
},
|
||||||
"invalid-accessmode": {
|
"invalid-accessmode": {
|
||||||
isExpectedFailure: true,
|
isExpectedFailure: true,
|
||||||
volume: testVolume("foo", "", api.PersistentVolumeSpec{
|
volume: testVolume("foo", "", api.PersistentVolumeSpec{
|
||||||
@ -528,6 +541,19 @@ func TestValidatePersistentVolumes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
"invalid-reclaimpolicy": {
|
||||||
|
isExpectedFailure: true,
|
||||||
|
volume: testVolume("foo", "", api.PersistentVolumeSpec{
|
||||||
|
Capacity: api.ResourceList{
|
||||||
|
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
|
||||||
|
},
|
||||||
|
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
|
||||||
|
PersistentVolumeSource: api.PersistentVolumeSource{
|
||||||
|
HostPath: &api.HostPathVolumeSource{Path: "/foo"},
|
||||||
|
},
|
||||||
|
PersistentVolumeReclaimPolicy: "fakeReclaimPolicy",
|
||||||
|
}),
|
||||||
|
},
|
||||||
"unexpected-namespace": {
|
"unexpected-namespace": {
|
||||||
isExpectedFailure: true,
|
isExpectedFailure: true,
|
||||||
volume: testVolume("foo", "unexpected-namespace", api.PersistentVolumeSpec{
|
volume: testVolume("foo", "unexpected-namespace", api.PersistentVolumeSpec{
|
||||||
|
Loading…
Reference in New Issue
Block a user