Added the feature to use secrets of ListSnapshots
This commit is contained in:
@@ -156,7 +156,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
expectedListCalls: []listCall{{"sid1-1", true, time.Now(), 1, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-1", map[string]string{}, true, time.Now(), 1, nil}},
|
||||
expectedDeleteCalls: []deleteCall{{"sid1-1", nil, nil}},
|
||||
test: testSyncContent,
|
||||
},
|
||||
@@ -178,7 +178,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
expectedListCalls: []listCall{{"sid1-2", true, time.Now(), 1, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-2", map[string]string{}, true, time.Now(), 1, nil}},
|
||||
expectedDeleteCalls: []deleteCall{{"sid1-2", nil, nil}},
|
||||
test: testSyncContent,
|
||||
},
|
||||
@@ -201,7 +201,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
},
|
||||
expectedDeleteCalls: []deleteCall{{"sid1-3", nil, fmt.Errorf("mock csi driver delete error")}},
|
||||
expectedEvents: []string{"Warning SnapshotDeleteError"},
|
||||
expectedListCalls: []listCall{{"sid1-3", true, time.Now(), 1, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-3", map[string]string{}, true, time.Now(), 1, nil}},
|
||||
test: testSyncContent,
|
||||
},
|
||||
{
|
||||
@@ -216,7 +216,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
name: "1-5 - csi driver delete snapshot returns error, bound finalizer should remain",
|
||||
initialContents: newContentArrayWithDeletionTimestamp("content1-5", "sid1-5", "snap1-5", "sid1-5", validSecretClass, "", "snap1-5-volumehandle", deletionPolicy, nil, &defaultSize, true, &timeNowMetav1),
|
||||
expectedContents: newContentArrayWithDeletionTimestamp("content1-5", "sid1-5", "snap1-5", "sid1-5", validSecretClass, "", "snap1-5-volumehandle", deletionPolicy, nil, &defaultSize, true, &timeNowMetav1),
|
||||
expectedListCalls: []listCall{{"sid1-5", true, time.Now(), 1000, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-5", map[string]string{}, true, time.Now(), 1000, nil}},
|
||||
expectedDeleteCalls: []deleteCall{{"sid1-5", nil, errors.New("mock csi driver delete error")}},
|
||||
expectedEvents: []string{"Warning SnapshotDeleteError"},
|
||||
errors: noerrors,
|
||||
@@ -227,7 +227,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
name: "1-6 - content is deleted before deleting",
|
||||
initialContents: newContentArray("content1-6", "sid1-6", "snap1-6", "sid1-6", classGold, "sid1-6", "", deletionPolicy, nil, nil, true),
|
||||
expectedContents: nocontents,
|
||||
expectedListCalls: []listCall{{"sid1-6", false, time.Now(), 0, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-6", nil, false, time.Now(), 0, nil}},
|
||||
expectedDeleteCalls: []deleteCall{{"sid1-6", map[string]string{"foo": "bar"}, nil}},
|
||||
expectedEvents: noevents,
|
||||
errors: noerrors,
|
||||
@@ -243,7 +243,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
initialContents: newContentArrayWithReadyToUse("content1-7", "", "snap1-7", "sid1-7", validSecretClass, "sid1-7", "", deletePolicy, nil, &defaultSize, &True, true),
|
||||
expectedContents: newContentArrayWithReadyToUse("content1-7", "", "snap1-7", "sid1-7", validSecretClass, "sid1-7", "", deletePolicy, nil, &defaultSize, &True, true),
|
||||
expectedEvents: noevents,
|
||||
expectedListCalls: []listCall{{"sid1-7", true, time.Now(), 1000, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-7", map[string]string{}, true, time.Now(), 1000, nil}},
|
||||
initialSecrets: []*v1.Secret{secret()},
|
||||
errors: noerrors,
|
||||
test: testSyncContent,
|
||||
@@ -253,7 +253,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
initialContents: newContentArrayWithReadyToUse("content1-8", "sid1-8", "none-existed-snapshot", "sid1-8", validSecretClass, "sid1-8", "", retainPolicy, nil, &defaultSize, &True, true),
|
||||
expectedContents: newContentArrayWithReadyToUse("content1-8", "sid1-8", "none-existed-snapshot", "sid1-8", validSecretClass, "sid1-8", "", retainPolicy, nil, &defaultSize, &True, true),
|
||||
expectedEvents: noevents,
|
||||
expectedListCalls: []listCall{{"sid1-8", true, time.Now(), 0, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-8", map[string]string{}, true, time.Now(), 0, nil}},
|
||||
errors: noerrors,
|
||||
test: testSyncContent,
|
||||
},
|
||||
@@ -262,7 +262,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
initialContents: newContentArrayWithDeletionTimestamp("content1-9", "sid1-9", "snap1-9", "sid1-9", emptySecretClass, "", "snap1-9-volumehandle", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),
|
||||
expectedContents: newContentArrayWithDeletionTimestamp("content1-9", "sid1-9", "snap1-9", "", emptySecretClass, "", "snap1-9-volumehandle", deletePolicy, nil, &defaultSize, false, &timeNowMetav1),
|
||||
expectedEvents: noevents,
|
||||
expectedListCalls: []listCall{{"sid1-9", true, time.Now(), 0, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-9", map[string]string{}, true, time.Now(), 0, nil}},
|
||||
errors: noerrors,
|
||||
initialSecrets: []*v1.Secret{}, // secret does not exist
|
||||
expectedDeleteCalls: []deleteCall{{"sid1-9", nil, nil}},
|
||||
@@ -273,7 +273,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
initialContents: newContentArrayWithDeletionTimestamp("content1-10", "sid1-10", "snap1-10", "sid1-10", emptySecretClass, "", "snap1-10-volumehandle", retainPolicy, nil, &defaultSize, true, &timeNowMetav1),
|
||||
expectedContents: newContentArrayWithDeletionTimestamp("content1-10", "sid1-10", "snap1-10", "sid1-10", emptySecretClass, "", "snap1-10-volumehandle", retainPolicy, nil, &defaultSize, false, &timeNowMetav1),
|
||||
expectedEvents: noevents,
|
||||
expectedListCalls: []listCall{{"sid1-10", true, time.Now(), 0, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-10", map[string]string{}, true, time.Now(), 0, nil}},
|
||||
errors: noerrors,
|
||||
initialSecrets: []*v1.Secret{},
|
||||
test: testSyncContent,
|
||||
@@ -292,7 +292,7 @@ func TestDeleteSync(t *testing.T) {
|
||||
initialContents: newContentArrayWithDeletionTimestamp("content1-12", "sid1-12", "snap1-12", "sid1-12", emptySecretClass, "sid1-12", "", retainPolicy, nil, &defaultSize, true, &timeNowMetav1),
|
||||
expectedContents: newContentArrayWithDeletionTimestamp("content1-12", "sid1-12", "snap1-12", "sid1-12", emptySecretClass, "sid1-12", "", retainPolicy, nil, &defaultSize, false, &timeNowMetav1),
|
||||
expectedEvents: noevents,
|
||||
expectedListCalls: []listCall{{"sid1-12", true, time.Now(), 0, nil}},
|
||||
expectedListCalls: []listCall{{"sid1-12", map[string]string{}, true, time.Now(), 0, nil}},
|
||||
errors: noerrors,
|
||||
initialSecrets: []*v1.Secret{},
|
||||
test: testSyncContent,
|
||||
|
Reference in New Issue
Block a user