Add code for testing final errors

This commit is contained in:
Hemant Kumar
2024-07-15 15:20:35 -04:00
parent c8d9863a3e
commit 785e68a626
5 changed files with 211 additions and 15 deletions

View File

@@ -88,7 +88,8 @@ const (
FailVolumeExpansion = "fail-expansion-test"
AlwaysFailNodeExpansion = "always-fail-node-expansion"
InfeasibleNodeExpansion = "infeasible-fail-node-expansion"
OtherFinalNodeExpansionError = "other-final-node-expansion-error"
deviceNotMounted = "deviceNotMounted"
deviceMountUncertain = "deviceMountUncertain"
@@ -500,8 +501,12 @@ func (plugin *FakeVolumePlugin) NodeExpand(resizeOptions volume.NodeResizeOption
return false, volumetypes.NewOperationNotSupportedError("volume-unsupported")
}
if resizeOptions.VolumeSpec.Name() == AlwaysFailNodeExpansion {
return false, fmt.Errorf("test failure: NodeExpand")
if resizeOptions.VolumeSpec.Name() == InfeasibleNodeExpansion {
return false, volumetypes.NewInfeasibleError("infeasible-expansion")
}
if resizeOptions.VolumeSpec.Name() == OtherFinalNodeExpansionError {
return false, fmt.Errorf("other-final-node-expansion-error")
}
if resizeOptions.VolumeSpec.Name() == FailVolumeExpansion {