sigs.k8s.io/blob-csi-driver@v1.24.1/test/e2e/testsuites/dynamically_provisioned_pod_with_multiple_pv.go (about) 1 /* 2 Copyright 2019 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package testsuites 18 19 import ( 20 "context" 21 22 "sigs.k8s.io/blob-csi-driver/test/e2e/driver" 23 24 "github.com/onsi/ginkgo/v2" 25 v1 "k8s.io/api/core/v1" 26 clientset "k8s.io/client-go/kubernetes" 27 ) 28 29 // DynamicallyProvisionedPodWithMultiplePVsTest will provision 30 // one pod with multiple PVs 31 // Waiting for the PV provisioner to create a new PV 32 // Testing if the Pod(s) Cmd is run with a 0 exit code 33 type DynamicallyProvisionedPodWithMultiplePVsTest struct { 34 CSIDriver driver.DynamicPVTestDriver 35 Pods []PodDetails 36 } 37 38 func (t *DynamicallyProvisionedPodWithMultiplePVsTest) Run(ctx context.Context, client clientset.Interface, namespace *v1.Namespace) { 39 for _, pod := range t.Pods { 40 tpod, cleanup := pod.SetupWithDynamicMultipleVolumes(ctx, client, namespace, t.CSIDriver) 41 // defer must be called here for resources not get removed before using them 42 for i := range cleanup { 43 defer cleanup[i](ctx) 44 } 45 46 ginkgo.By("deploying the pod") 47 tpod.Create(ctx) 48 defer tpod.Cleanup(ctx) 49 ginkgo.By("checking that the pods command exits with no error") 50 tpod.WaitForSuccess(ctx) 51 } 52 }