diff --git a/pkg/drivers/common_test.go b/pkg/drivers/common_test.go index e17b195c..70385a61 100644 --- a/pkg/drivers/common_test.go +++ b/pkg/drivers/common_test.go @@ -326,6 +326,8 @@ func getPmaxCommonEnvs() []corev1.EnvVar { func csmWithPowerScale(driver csmv1.DriverType, version string) csmv1.ContainerStorageModule { res := shared.MakeCSM("csm", "driver-test", shared.ConfigVersion) + res.Spec.Driver.CSIDriverSpec=&csmv1.CSIDriverSpec{ + } // Add FSGroupPolicy if res.Spec.Driver.CSIDriverSpec != nil { @@ -361,6 +363,7 @@ func csmWithPowerScale(driver csmv1.DriverType, version string) csmv1.ContainerS healthMonitor := corev1.EnvVar{Name: "X_CSI_HEALTH_MONITOR_ENABLED", Value: "true"} // Add node fields specific + res.Spec.Driver.Node = &csmv1.ContainerTemplate{} if res.Spec.Driver.Node != nil { res.Spec.Driver.Node.NodeSelector = map[string]string{"thisIs": "NodeSelector"} res.Spec.Driver.Node.Envs = []corev1.EnvVar{csiLogLevel} @@ -368,9 +371,11 @@ func csmWithPowerScale(driver csmv1.DriverType, version string) csmv1.ContainerS } // Add controller fields specific + res.Spec.Driver.Controller = &csmv1.ContainerTemplate{} if res.Spec.Driver.Controller != nil { res.Spec.Driver.Controller.NodeSelector = map[string]string{"thisIs": "NodeSelector"} res.Spec.Driver.Controller.Envs = []corev1.EnvVar{csiLogLevel} + res.Spec.Driver.Controller.Envs = []corev1.EnvVar{healthMonitor} } if res.Spec.Driver.CSIDriverSpec != nil { diff --git a/pkg/drivers/powerscale_test.go b/pkg/drivers/powerscale_test.go index 6c2ed9b3..2a67f5cc 100644 --- a/pkg/drivers/powerscale_test.go +++ b/pkg/drivers/powerscale_test.go @@ -28,6 +28,7 @@ import ( var ( powerScaleCSM = csmForPowerScale() + powerScaleCSMEmptyEnv = csmForPowerScaleWithEmptyEnv() powerScaleCSMBadSkipCert = csmForPowerScaleBadSkipCert() powerScaleCSMBadCertCnt = csmForPowerScaleBadCertCnt() powerScaleCSMBadVersion = csmForPowerScaleBadVersion() @@ -65,6 +66,7 @@ var ( }{ {"missing secret", powerScaleCSM, powerScaleClient, powerScaleSecret, "failed to find secret"}, {"bad version", powerScaleCSMBadVersion, powerScaleClient, powerScaleSecret, "not supported"}, + {"missing envs", powerScaleCSMEmptyEnv, powerScaleClient, powerScaleSecret, "failed to find secret"}, } ) @@ -138,6 +140,19 @@ func csmForPowerScale() csmv1.ContainerStorageModule { return res } +func csmForPowerScaleWithEmptyEnv() csmv1.ContainerStorageModule { + res := shared.MakeCSM("csm", "driver-test", shared.ConfigVersion) + + res.Spec.Driver.Common.Envs = []corev1.EnvVar{} + res.Spec.Driver.AuthSecret = "csm-creds" + + // Add pscale driver version + res.Spec.Driver.ConfigVersion = shared.ConfigVersion + res.Spec.Driver.CSIDriverType = csmv1.PowerScale + + return res +} + // makes a csm object with tolerations func csmForPowerScaleBadSkipCert() csmv1.ContainerStorageModule { res := shared.MakeCSM("csm", "driver-test", shared.ConfigVersion)