targetoee commented on code in PR #687:
URL: https://github.com/apache/yunikorn-k8shim/pull/687#discussion_r1377005752


##########
test/e2e/persistent_volume/persistent_volume_test.go:
##########
@@ -0,0 +1,349 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package persistent_volume
+
+import (
+       "time"
+
+       "github.com/onsi/gomega"
+
+       "k8s.io/apimachinery/pkg/api/resource"
+
+       appsv1 "k8s.io/api/apps/v1"
+       v1 "k8s.io/api/core/v1"
+       rbacv1 "k8s.io/api/rbac/v1"
+       storagev1 "k8s.io/api/storage/v1"
+       metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+       "github.com/onsi/ginkgo/v2"
+
+       "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/common"
+       "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/k8s"
+       "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/yunikorn"
+)
+
+var kClient k8s.KubeCtl
+var restClient yunikorn.RClient
+var dev = "dev-" + common.RandSeq(5)
+
+var _ = ginkgo.BeforeSuite(func() {
+       // Initializing kubectl client
+       kClient = k8s.KubeCtl{}
+       Ω(kClient.SetClient()).To(gomega.BeNil())
+
+       // Initializing rest client
+       restClient = yunikorn.RClient{}
+       Ω(restClient).NotTo(gomega.BeNil())
+
+       yunikorn.EnsureYuniKornConfigsPresent()
+
+       // Create namespace
+       ginkgo.By("Create namespace " + dev)
+       ns, err := kClient.CreateNamespace(dev, nil)
+       Ω(err).NotTo(HaveOccurred())
+       Ω(ns.Status.Phase).To(gomega.Equal(v1.NamespaceActive))
+})
+
+var _ = ginkgo.AfterSuite(func() {
+       // Clean up
+       err := kClient.DeletePVCs(dev)
+       Ω(err).NotTo(HaveOccurred())
+
+       err = kClient.DeletePVs(dev)
+       Ω(err).NotTo(HaveOccurred())
+
+       ginkgo.By("Tearing down namespace: " + dev)
+       err = kClient.TearDownNamespace(dev)
+       Ω(err).NotTo(HaveOccurred())

Review Comment:
   If there are PVs that exist before the test starts, deleting all of them may 
cause errors. I think it would be safer to only delete the PVs related to the 
test namespace.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to