@@ -233,6 +233,29 @@ func createThinStorageClass() {
233233 gomega .Expect (err ).To (gomega .BeNil (), "while creating a thinProvision storageclass {%s}" , scName )
234234}
235235
236+ func createFormatOptionsStorageClass (formatOptions string ) {
237+ var (
238+ err error
239+ )
240+
241+ parameters := map [string ]string {
242+ "volgroup" : VOLGROUP ,
243+ "formatOptions" : formatOptions ,
244+ }
245+
246+ ginkgo .By ("building a default storage class" )
247+ scObj , err = sc .NewBuilder ().
248+ WithGenerateName (scName ).
249+ WithVolumeExpansion (true ).
250+ WithParametersNew (parameters ).
251+ WithProvisioner (LocalProvisioner ).Build ()
252+ gomega .Expect (err ).ShouldNot (gomega .HaveOccurred (),
253+ "while building formatOptions storageclass obj with prefix {%s}" , scName )
254+
255+ scObj , err = SCClient .Create (scObj )
256+ gomega .Expect (err ).To (gomega .BeNil (), "while creating a storageclass with formatOptions {%s}" , scName )
257+ }
258+
236259// VerifyLVMVolume verify the properties of a lvm-volume
237260// expected_vg is supposed to be passed only when vgpatten was used for scheduling.
238261// If its volgroup in sc then we can just match volgroup with lvmvolume's vg field.
@@ -560,6 +583,109 @@ func createAndDeployBlockAppPod() {
560583 }
561584}
562585
586+ func createDeployVerifyFormatOptions () {
587+ ginkgo .By ("creating and deploying verifier pod" )
588+ createAndDeployVerifyFormatOptions ()
589+ ginkgo .By ("verifying verifier pod is running" , verifyFormatOptionsVerifierPodRunning )
590+ }
591+
592+ func createAndDeployVerifyFormatOptions () {
593+ var err error
594+ appname := "format-options-verifier"
595+ labels := map [string ]string {
596+ "role" : "test" ,
597+ "app" : appname ,
598+ }
599+ ginkgo .By ("building app " + appname + " using above lvm volume" )
600+ deployObj , err = deploy .NewBuilder ().
601+ WithName (appname ).
602+ WithNamespace (OpenEBSNamespace ).
603+ WithLabelsNew (labels ).
604+ WithSelectorMatchLabelsNew (labels ).
605+ WithPodTemplateSpecBuilder (
606+ pts .NewBuilder ().
607+ WithLabelsNew (labels ).
608+ WithContainerBuilders (
609+ container .NewBuilder ().
610+ WithImage ("debian:stable-slim" ).
611+ WithName ("verifier" ).
612+ WithImagePullPolicy (corev1 .PullIfNotPresent ).
613+ WithEnvsNew (
614+ []corev1.EnvVar {
615+ {
616+ Name : "MIN_INODES" ,
617+ Value : "5000000" ,
618+ },
619+ },
620+ ).
621+ WithCommandNew (
622+ []string {
623+ "bash" ,
624+ "-c" ,
625+ `test "$(df -i '/mnt/datadir' | tail -n 1 | awk '{print $2}')" -ge "$MIN_INODES" && tail -f /dev/null` ,
626+ },
627+ ).
628+ WithLifeCycle (
629+ & corev1.Lifecycle {
630+ PreStop : & corev1.LifecycleHandler {
631+ Exec : & corev1.ExecAction {
632+ Command : []string {
633+ "bash" ,
634+ "-c" ,
635+ "kill -9 $(pidof tail)" ,
636+ },
637+ },
638+ },
639+ },
640+ ).
641+ WithVolumeMountsNew (
642+ []corev1.VolumeMount {
643+ {
644+ Name : "datavol1" ,
645+ // If this path changes, modify the above command line accordingly (df command).
646+ MountPath : "/mnt/datadir" ,
647+ },
648+ },
649+ ),
650+ ).
651+ WithVolumeBuilders (
652+ k8svolume .NewBuilder ().
653+ WithName ("datavol1" ).
654+ WithPVCSource (pvcObj .Name ),
655+ ),
656+ ).
657+ Build ()
658+
659+ gomega .Expect (err ).ShouldNot (gomega .HaveOccurred (), "while building app deployement {%s}" , appname )
660+
661+ deployObj , err = DeployClient .WithNamespace (OpenEBSNamespace ).Create (deployObj )
662+ gomega .Expect (err ).ShouldNot (
663+ gomega .HaveOccurred (),
664+ "while creating pod {%s} in namespace {%s}" ,
665+ appname ,
666+ OpenEBSNamespace ,
667+ )
668+ }
669+
670+ func verifyFormatOptionsVerifierPodRunning () {
671+ var err error
672+ appName := "format-options-verifier"
673+ labelValue := fmt .Sprintf ("role=test,app=%s" , appName )
674+ gomega .Eventually (func () bool {
675+ appPod , err = PodClient .WithNamespace (OpenEBSNamespace ).
676+ List (metav1.ListOptions {
677+ LabelSelector : labelValue ,
678+ })
679+ gomega .Expect (err ).ShouldNot (gomega .HaveOccurred (), "while verifying application pod" )
680+ return len (appPod .Items ) == 1
681+ },
682+ 60 , 5 ).
683+ Should (gomega .BeTrue ())
684+
685+ status := IsPodRunningEventually (OpenEBSNamespace , appPod .Items [0 ].Name )
686+ gomega .Expect (status ).To (gomega .Equal (true ), "while checking status of pod {%s}" , appPod .Items [0 ].Name )
687+ }
688+
563689func createDeployVerifyBlockApp () {
564690 ginkgo .By ("creating and deploying app pod" , createAndDeployBlockAppPod )
565691 ginkgo .By ("verifying app pod is running" , verifyAppPodRunning )
0 commit comments