Fix test driver's unique name consistent

Fixes: #70760
This commit is contained in:
Masaki Kimura 2018-11-07 22:17:46 +00:00
parent a320766403
commit d33211dc44
3 changed files with 10 additions and 5 deletions

View File

@ -192,7 +192,7 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
test := t test := t
It(test.name, func() { It(test.name, func() {
if test.driverExists { if test.driverExists {
csiDriver := createCSIDriver(csics, "csi-hostpath-"+f.UniqueName, test.driverAttachable) csiDriver := createCSIDriver(csics, drivers.GetUniqueDriverName(driver), test.driverAttachable)
if csiDriver != nil { if csiDriver != nil {
defer csics.CsiV1alpha1().CSIDrivers().Delete(csiDriver.Name, nil) defer csics.CsiV1alpha1().CSIDrivers().Delete(csiDriver.Name, nil)
} }

View File

@ -176,3 +176,8 @@ func getStorageClass(
VolumeBindingMode: bindingMode, VolumeBindingMode: bindingMode,
} }
} }
// GetUniqueDriverName returns unique driver name that can be used parallelly in tests
func GetUniqueDriverName(driver TestDriver) string {
return fmt.Sprintf("%s-%s", driver.GetDriverInfo().Name, driver.GetDriverInfo().Framework.UniqueName)
}

View File

@ -82,7 +82,7 @@ func (h *hostpathCSIDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern
} }
func (h *hostpathCSIDriver) GetDynamicProvisionStorageClass(fsType string) *storagev1.StorageClass { func (h *hostpathCSIDriver) GetDynamicProvisionStorageClass(fsType string) *storagev1.StorageClass {
provisioner := h.driverInfo.Name + h.driverInfo.Framework.UniqueName provisioner := GetUniqueDriverName(h)
parameters := map[string]string{} parameters := map[string]string{}
ns := h.driverInfo.Framework.Namespace.Name ns := h.driverInfo.Framework.Namespace.Name
suffix := fmt.Sprintf("%s-sc", provisioner) suffix := fmt.Sprintf("%s-sc", provisioner)
@ -105,7 +105,7 @@ func (h *hostpathCSIDriver) CreateDriver() {
// settings are ignored for this test. We could patch the image definitions. // settings are ignored for this test. We could patch the image definitions.
o := utils.PatchCSIOptions{ o := utils.PatchCSIOptions{
OldDriverName: h.driverInfo.Name, OldDriverName: h.driverInfo.Name,
NewDriverName: h.driverInfo.Name + h.driverInfo.Framework.UniqueName, NewDriverName: GetUniqueDriverName(h),
DriverContainerName: "hostpath", DriverContainerName: "hostpath",
ProvisionerContainerName: "csi-provisioner", ProvisionerContainerName: "csi-provisioner",
NodeName: h.driverInfo.Config.ServerNodeName, NodeName: h.driverInfo.Config.ServerNodeName,
@ -199,8 +199,8 @@ func (g *gcePDCSIDriver) CreateDriver() {
// //
// These are the options which would have to be used: // These are the options which would have to be used:
// o := utils.PatchCSIOptions{ // o := utils.PatchCSIOptions{
// OldDriverName: "com.google.csi.gcepd", // OldDriverName: g.driverInfo.Name,
// NewDriverName: "com.google.csi.gcepd-" + g.f.UniqueName, // NewDriverName: GetUniqueDriverName(g),
// DriverContainerName: "gce-driver", // DriverContainerName: "gce-driver",
// ProvisionerContainerName: "csi-external-provisioner", // ProvisionerContainerName: "csi-external-provisioner",
// } // }