Skip to content

Commit 94b454b

Browse files
committed
fix: correct typo in comment regarding excluded volumes in TestGetVolumesByPod
Signed-off-by: Priyansh Choudhary <im1706@gmail.com>
1 parent 11c89cf commit 94b454b

2 files changed

Lines changed: 1 addition & 70 deletions

File tree

internal/delete/actions/csi/volumesnapshotcontent_action_test.go

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -251,67 +251,6 @@ func TestCheckVSCReadiness(t *testing.T) {
251251
}
252252
})
253253
}
254-
255-
// Error injection tests for tryDeleteOriginalVSC
256-
t.Run("Get returns non-NotFound error, returns false", func(t *testing.T) {
257-
errClient := &fakeClientWithErrors{
258-
Client: velerotest.NewFakeControllerRuntimeClient(t),
259-
getError: fmt.Errorf("connection refused"),
260-
}
261-
p := &volumeSnapshotContentDeleteItemAction{
262-
log: logrus.StandardLogger(),
263-
crClient: errClient,
264-
}
265-
require.False(t, p.tryDeleteOriginalVSC(t.Context(), "some-vsc"))
266-
})
267-
268-
t.Run("Patch fails, returns false", func(t *testing.T) {
269-
realClient := velerotest.NewFakeControllerRuntimeClient(t)
270-
vsc := &snapshotv1api.VolumeSnapshotContent{
271-
ObjectMeta: metav1.ObjectMeta{Name: "patch-fail-vsc"},
272-
Spec: snapshotv1api.VolumeSnapshotContentSpec{
273-
DeletionPolicy: snapshotv1api.VolumeSnapshotContentRetain,
274-
Driver: "disk.csi.azure.com",
275-
Source: snapshotv1api.VolumeSnapshotContentSource{SnapshotHandle: stringPtr("snap-789")},
276-
VolumeSnapshotRef: corev1api.ObjectReference{Name: "vs-3", Namespace: "default"},
277-
},
278-
}
279-
require.NoError(t, realClient.Create(t.Context(), vsc))
280-
281-
errClient := &fakeClientWithErrors{
282-
Client: realClient,
283-
patchError: fmt.Errorf("patch forbidden"),
284-
}
285-
p := &volumeSnapshotContentDeleteItemAction{
286-
log: logrus.StandardLogger(),
287-
crClient: errClient,
288-
}
289-
require.False(t, p.tryDeleteOriginalVSC(t.Context(), "patch-fail-vsc"))
290-
})
291-
292-
t.Run("Delete fails, returns false", func(t *testing.T) {
293-
realClient := velerotest.NewFakeControllerRuntimeClient(t)
294-
vsc := &snapshotv1api.VolumeSnapshotContent{
295-
ObjectMeta: metav1.ObjectMeta{Name: "delete-fail-vsc"},
296-
Spec: snapshotv1api.VolumeSnapshotContentSpec{
297-
DeletionPolicy: snapshotv1api.VolumeSnapshotContentDelete,
298-
Driver: "disk.csi.azure.com",
299-
Source: snapshotv1api.VolumeSnapshotContentSource{SnapshotHandle: stringPtr("snap-999")},
300-
VolumeSnapshotRef: corev1api.ObjectReference{Name: "vs-4", Namespace: "default"},
301-
},
302-
}
303-
require.NoError(t, realClient.Create(t.Context(), vsc))
304-
305-
errClient := &fakeClientWithErrors{
306-
Client: realClient,
307-
deleteError: fmt.Errorf("delete forbidden"),
308-
}
309-
p := &volumeSnapshotContentDeleteItemAction{
310-
log: logrus.StandardLogger(),
311-
crClient: errClient,
312-
}
313-
require.False(t, p.tryDeleteOriginalVSC(t.Context(), "delete-fail-vsc"))
314-
})
315254
}
316255

317256
func TestVSCExecute_CreateSleepDeleteOrder(t *testing.T) {
@@ -346,11 +285,3 @@ func TestVSCExecute_CreateSleepDeleteOrder(t *testing.T) {
346285
require.NoError(t, err)
347286
require.Equal(t, []string{"create", "sleep", "delete"}, events)
348287
}
349-
350-
func boolPtr(b bool) *bool {
351-
return &b
352-
}
353-
354-
func stringPtr(s string) *string {
355-
return &s
356-
}

pkg/util/podvolume/pod_volume_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func TestGetVolumesByPod(t *testing.T) {
156156
Volumes: []corev1api.Volume{
157157
// PVB Volumes
158158
{Name: "pvbPV1"}, {Name: "pvbPV2"}, {Name: "pvbPV3"},
159-
/// Excluded from PVB because colume mounting default service account token
159+
/// Excluded from PVB because column mounting default service account token
160160
{Name: "default-token-5xq45"},
161161
},
162162
},

0 commit comments

Comments
 (0)