@@ -62,11 +62,12 @@ const (
62
62
63
63
// hostpathCSI
64
64
type hostpathCSIDriver struct {
65
- driverInfo testsuites.DriverInfo
66
- manifests []string
65
+ driverInfo testsuites.DriverInfo
66
+ manifests []string
67
+ volumeAttributes []map [string ]string
67
68
}
68
69
69
- func initHostPathCSIDriver (name string , capabilities map [testsuites.Capability ]bool , manifests ... string ) testsuites.TestDriver {
70
+ func initHostPathCSIDriver (name string , capabilities map [testsuites.Capability ]bool , volumeAttributes [] map [ string ] string , manifests ... string ) testsuites.TestDriver {
70
71
return & hostpathCSIDriver {
71
72
driverInfo : testsuites.DriverInfo {
72
73
Name : name ,
@@ -77,13 +78,15 @@ func initHostPathCSIDriver(name string, capabilities map[testsuites.Capability]b
77
78
),
78
79
Capabilities : capabilities ,
79
80
},
80
- manifests : manifests ,
81
+ manifests : manifests ,
82
+ volumeAttributes : volumeAttributes ,
81
83
}
82
84
}
83
85
84
86
var _ testsuites.TestDriver = & hostpathCSIDriver {}
85
87
var _ testsuites.DynamicPVTestDriver = & hostpathCSIDriver {}
86
88
var _ testsuites.SnapshottableTestDriver = & hostpathCSIDriver {}
89
+ var _ testsuites.EphemeralTestDriver = & hostpathCSIDriver {}
87
90
88
91
// InitHostPathCSIDriver returns hostpathCSIDriver that implements TestDriver interface
89
92
func InitHostPathCSIDriver () testsuites.TestDriver {
@@ -97,16 +100,20 @@ func InitHostPathCSIDriver() testsuites.TestDriver {
97
100
}
98
101
return initHostPathCSIDriver ("csi-hostpath" ,
99
102
capabilities ,
100
- "test/e2e/testing-manifests/storage-csi/driver-registrar/rbac.yaml" ,
103
+ // Volume attributes don't matter, but we have to provide at least one map.
104
+ []map [string ]string {
105
+ {"foo" : "bar" },
106
+ },
101
107
"test/e2e/testing-manifests/storage-csi/external-attacher/rbac.yaml" ,
102
108
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml" ,
103
109
"test/e2e/testing-manifests/storage-csi/external-snapshotter/rbac.yaml" ,
104
110
"test/e2e/testing-manifests/storage-csi/external-resizer/rbac.yaml" ,
105
111
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-attacher.yaml" ,
112
+ "test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-driverinfo.yaml" ,
113
+ "test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml" ,
106
114
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-provisioner.yaml" ,
107
- "test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-snapshotter.yaml" ,
108
115
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-resizer.yaml" ,
109
- "test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpathplugin .yaml" ,
116
+ "test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-snapshotter .yaml" ,
110
117
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/e2e-test-rbac.yaml" ,
111
118
)
112
119
}
@@ -116,6 +123,9 @@ func (h *hostpathCSIDriver) GetDriverInfo() *testsuites.DriverInfo {
116
123
}
117
124
118
125
func (h * hostpathCSIDriver ) SkipUnsupportedTest (pattern testpatterns.TestPattern ) {
126
+ if pattern .VolType == testpatterns .CSIInlineVolume && len (h .volumeAttributes ) == 0 {
127
+ framework .Skipf ("%s has no volume attributes defined, doesn't support ephemeral inline volumes" , h .driverInfo .Name )
128
+ }
119
129
}
120
130
121
131
func (h * hostpathCSIDriver ) GetDynamicProvisionStorageClass (config * testsuites.PerTestConfig , fsType string ) * storagev1.StorageClass {
@@ -127,6 +137,14 @@ func (h *hostpathCSIDriver) GetDynamicProvisionStorageClass(config *testsuites.P
127
137
return testsuites .GetStorageClass (provisioner , parameters , nil , ns , suffix )
128
138
}
129
139
140
+ func (h * hostpathCSIDriver ) GetVolume (config * testsuites.PerTestConfig , volumeNumber int ) (map [string ]string , bool , bool ) {
141
+ return h .volumeAttributes [volumeNumber % len (h .volumeAttributes )], false /* not shared */ , false /* read-write */
142
+ }
143
+
144
+ func (h * hostpathCSIDriver ) GetCSIDriverName (config * testsuites.PerTestConfig ) string {
145
+ return config .GetUniqueDriverName ()
146
+ }
147
+
130
148
func (h * hostpathCSIDriver ) GetSnapshotClass (config * testsuites.PerTestConfig ) * unstructured.Unstructured {
131
149
snapshotter := config .GetUniqueDriverName ()
132
150
parameters := map [string ]string {}
@@ -205,7 +223,6 @@ var _ testsuites.DynamicPVTestDriver = &mockCSIDriver{}
205
223
// InitMockCSIDriver returns a mockCSIDriver that implements TestDriver interface
206
224
func InitMockCSIDriver (driverOpts CSIMockDriverOpts ) testsuites.TestDriver {
207
225
driverManifests := []string {
208
- "test/e2e/testing-manifests/storage-csi/driver-registrar/rbac.yaml" ,
209
226
"test/e2e/testing-manifests/storage-csi/external-attacher/rbac.yaml" ,
210
227
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml" ,
211
228
"test/e2e/testing-manifests/storage-csi/external-resizer/rbac.yaml" ,
@@ -305,7 +322,7 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTest
305
322
NodeName : config .ClientNodeName ,
306
323
PodInfo : m .podInfo ,
307
324
CanAttach : & m .attachable ,
308
- VolumeLifecycleModes : []storagev1beta1.VolumeLifecycleMode {
325
+ VolumeLifecycleModes : & []storagev1beta1.VolumeLifecycleMode {
309
326
storagev1beta1 .VolumeLifecyclePersistent ,
310
327
storagev1beta1 .VolumeLifecycleEphemeral ,
311
328
},
@@ -329,7 +346,10 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTest
329
346
func InitHostPathV0CSIDriver () testsuites.TestDriver {
330
347
return initHostPathCSIDriver ("csi-hostpath-v0" ,
331
348
map [testsuites.Capability ]bool {testsuites .CapPersistence : true , testsuites .CapMultiPODs : true },
332
- "test/e2e/testing-manifests/storage-csi/driver-registrar/rbac.yaml" ,
349
+ nil , /* no volume attributes -> no ephemeral volume testing */
350
+ // Using the current set of rbac.yaml files is problematic here because they don't
351
+ // match the version of the rules that were written for the releases of external-attacher
352
+ // and external-provisioner that we are using here. It happens to work in practice...
333
353
"test/e2e/testing-manifests/storage-csi/external-attacher/rbac.yaml" ,
334
354
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml" ,
335
355
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath-v0/csi-hostpath-attacher.yaml" ,
@@ -423,7 +443,6 @@ func (g *gcePDCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTes
423
443
createGCESecrets (f .ClientSet , f .Namespace .Name )
424
444
425
445
manifests := []string {
426
- "test/e2e/testing-manifests/storage-csi/driver-registrar/rbac.yaml" ,
427
446
"test/e2e/testing-manifests/storage-csi/external-attacher/rbac.yaml" ,
428
447
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml" ,
429
448
"test/e2e/testing-manifests/storage-csi/gce-pd/csi-controller-rbac.yaml" ,
0 commit comments