@@ -11,10 +11,21 @@ import (
1111
1212 "github.com/serverscom/rbs-csi-driver/pkg/mocks"
1313 serverscom "github.com/serverscom/serverscom-go-client/pkg"
14+ corev1 "k8s.io/api/core/v1"
15+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1416 "k8s.io/client-go/kubernetes/fake"
1517)
1618
17- var kubeFakeClient = fake .NewSimpleClientset ()
19+ var (
20+ testPvc = & corev1.PersistentVolumeClaim {
21+ ObjectMeta : metav1.ObjectMeta {
22+ Name : "rbs-pvc-example" ,
23+ Namespace : "default" ,
24+ },
25+ }
26+
27+ kubeFakeClient = fake .NewSimpleClientset (testPvc )
28+ )
1829
1930func TestCreateVolume_SuccessWithIDs (t * testing.T ) {
2031 g := NewGomegaWithT (t )
@@ -31,8 +42,10 @@ func TestCreateVolume_SuccessWithIDs(t *testing.T) {
3142 RequiredBytes : 10 * 1024 * 1024 * 1024 , // 10GB
3243 },
3344 Parameters : map [string ]string {
34- "rbs.csi.servers.com/location" : "1" ,
35- "rbs.csi.servers.com/flavor" : "2" ,
45+ "rbs.csi.servers.com/location" : "1" ,
46+ "rbs.csi.servers.com/flavor" : "2" ,
47+ "csi.storage.k8s.io/pvc/name" : "rbs-pvc-example" ,
48+ "csi.storage.k8s.io/pvc/namespace" : "default" ,
3649 },
3750 }
3851
@@ -75,8 +88,10 @@ func TestCreateVolume_SuccessWithNames(t *testing.T) {
7588 RequiredBytes : 10 * 1024 * 1024 * 1024 , // 10GB
7689 },
7790 Parameters : map [string ]string {
78- "rbs.csi.servers.com/location" : "test-location" ,
79- "rbs.csi.servers.com/flavor" : "test-flavor" ,
91+ "rbs.csi.servers.com/location" : "test-location" ,
92+ "rbs.csi.servers.com/flavor" : "test-flavor" ,
93+ "csi.storage.k8s.io/pvc/name" : "rbs-pvc-example" ,
94+ "csi.storage.k8s.io/pvc/namespace" : "default" ,
8095 },
8196 }
8297
0 commit comments