Merge pull request #72375 from sbezverk/containers_volumedevices

VolumeDevices validation and tests
This commit is contained in:
Kubernetes Prow Robot
2018-12-27 17:39:05 -08:00
committed by GitHub
4 changed files with 147 additions and 82 deletions

View File

@@ -4961,10 +4961,6 @@ func TestAlphaValidateVolumeDevices(t *testing.T) {
return
}
disabledAlphaVolDevice := []core.VolumeDevice{
{Name: "abc", DevicePath: "/foo"},
}
successCase := []core.VolumeDevice{
{Name: "abc", DevicePath: "/foo"},
{Name: "abc-123", DevicePath: "/usr/share/test"},
@@ -4992,8 +4988,6 @@ func TestAlphaValidateVolumeDevices(t *testing.T) {
{Name: "abc-123", MountPath: "/this/path/exists"},
}
// enable BlockVolume
defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.BlockVolume, true)()
// Success Cases:
// Validate normal success cases - only PVC volumeSource
if errs := ValidateVolumeDevices(successCase, GetVolumeMountMap(goodVolumeMounts), vols, field.NewPath("field")); len(errs) != 0 {
@@ -5007,12 +5001,6 @@ func TestAlphaValidateVolumeDevices(t *testing.T) {
t.Errorf("expected failure for %s", k)
}
}
// disable BlockVolume
defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.BlockVolume, false)()
if errs := ValidateVolumeDevices(disabledAlphaVolDevice, GetVolumeMountMap(goodVolumeMounts), vols, field.NewPath("field")); len(errs) == 0 {
t.Errorf("expected failure: %v", errs)
}
}
func TestValidateProbe(t *testing.T) {