Skip to content

Commit

Permalink
Add fake storage class for dataupload test
Browse files Browse the repository at this point in the history
Signed-off-by: MICHAEL S FRUCHTMAN <[email protected]>
  • Loading branch information
msfrucht committed Jun 25, 2024
1 parent 04d37da commit 75b1f38
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/controller/data_upload_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
storagev1api "k8s.io/api/storage/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -149,6 +150,13 @@ func initDataUploaderReconcilerWithError(needError ...error) (*DataUploadReconci
RestoreSize: &resource.Quantity{},
},
}
storageClassObject := &storagev1api.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: "default",
},
Provisioner: "fake.velero",
Parameters: map[string]string{},
}
var restoreSize int64
vscObj := &snapshotv1api.VolumeSnapshotContent{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -214,7 +222,7 @@ func initDataUploaderReconcilerWithError(needError ...error) (*DataUploadReconci
}
}

fakeSnapshotClient := snapshotFake.NewSimpleClientset(vsObject, vscObj)
fakeSnapshotClient := snapshotFake.NewSimpleClientset(vsObject, vscObj, storageClassObject)
fakeKubeClient := clientgofake.NewSimpleClientset(daemonSet)
fakeFS := velerotest.NewFakeFileSystem()
pathGlob := fmt.Sprintf("/host_pods/%s/volumes/*/%s", "", dataUploadName)
Expand Down

0 comments on commit 75b1f38

Please sign in to comment.