CSIStorageCapacity: prepare tests for enabling the feature by default

Defaults and validation are such that the field has to be set when
the feature is enabled, just as for the other boolean fields. This
was missing in some tests, which was okay as long as they ran
with the feature disabled. Once it gets enabled, validation will
flag the missing field as error.

Other tests didn't run at all.
This commit is contained in:
Patrick Ohly
2021-03-03 21:01:05 +01:00
parent 72d92159bc
commit 504f105a9e
3 changed files with 116 additions and 14 deletions

View File

@@ -49,6 +49,7 @@ func validNewCSIDriver(name string) *storageapi.CSIDriver {
attachRequired := true
podInfoOnMount := true
requiresRepublish := true
storageCapacity := true
return &storageapi.CSIDriver{
ObjectMeta: metav1.ObjectMeta{
Name: name,
@@ -57,6 +58,7 @@ func validNewCSIDriver(name string) *storageapi.CSIDriver {
AttachRequired: &attachRequired,
PodInfoOnMount: &podInfoOnMount,
RequiresRepublish: &requiresRepublish,
StorageCapacity: &storageCapacity,
},
}
}
@@ -71,6 +73,7 @@ func TestCreate(t *testing.T) {
attachNotRequired := false
notPodInfoOnMount := false
notRequiresRepublish := false
notStorageCapacity := false
test.TestCreate(
// valid
csiDriver,
@@ -81,6 +84,7 @@ func TestCreate(t *testing.T) {
AttachRequired: &attachNotRequired,
PodInfoOnMount: &notPodInfoOnMount,
RequiresRepublish: &notRequiresRepublish,
StorageCapacity: &notStorageCapacity,
},
},
)