Updated sidecar to not require VolumeSnapshotClass for snapshot deletion

This commit is contained in:
Christian Huffman
2020-04-07 15:14:24 -04:00
parent 0a9f3c2181
commit daf0051f2b
3 changed files with 10 additions and 9 deletions

View File

@@ -221,10 +221,11 @@ func TestDeleteSync(t *testing.T) {
test: testSyncContent,
},
{
name: "1-4 - fail to delete with a snapshot class which has invalid secret parameter, bound finalizer should remain",
initialContents: newContentArrayWithDeletionTimestamp("content1-1", "snapuid1-1", "snap1-1", "sid1-1", "invalid", "", "snap1-4-volumehandle", deletionPolicy, nil, nil, true, &timeNowMetav1),
expectedContents: newContentArrayWithDeletionTimestamp("content1-1", "snapuid1-1", "snap1-1", "sid1-1", "invalid", "", "snap1-4-volumehandle", deletionPolicy, nil, nil, true, &timeNowMetav1),
expectedEvents: noevents,
name: "1-4 - fail to delete with a snapshot class which has invalid secret parameter, bound finalizer should remain",
initialContents: newContentArrayWithDeletionTimestamp("content1-1", "snapuid1-1", "snap1-1", "sid1-1", "invalid", "", "snap1-4-volumehandle", deletionPolicy, nil, nil, true, &timeNowMetav1),
expectedContents: newContentArrayWithDeletionTimestamp("content1-1", "snapuid1-1", "snap1-1", "sid1-1", "invalid", "", "snap1-4-volumehandle", deletionPolicy, nil, nil, true, &timeNowMetav1),
expectedEvents: noevents,
expectedDeleteCalls: []deleteCall{{"sid1-1", nil, fmt.Errorf("mock csi driver delete error")}},
errors: []reactorError{
// Inject error to the first client.VolumesnapshotV1beta1().VolumeSnapshotContents().Delete call.
// All other calls will succeed.
@@ -336,10 +337,9 @@ func TestDeleteSync(t *testing.T) {
test: testSyncContent,
},
{
name: "1-15 - (dynamic)deletion of content with no snapshotclass should produce error",
name: "1-15 - (dynamic)deletion of content with no snapshotclass should succeed",
initialContents: newContentArrayWithDeletionTimestamp("content1-15", "sid1-15", "snap1-15", "sid1-15", "", "", "snap1-15-volumehandle", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),
expectedContents: newContentArrayWithDeletionTimestamp("content1-15", "sid1-15", "snap1-15", "sid1-15", "", "", "snap1-15-volumehandle", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),
expectedEvents: []string{"Warning SnapshotDeleteError"},
errors: noerrors,
expectedDeleteCalls: []deleteCall{{"sid1-15", nil, nil}},
test: testSyncContent,