anuraagnalluri commented on a change in pull request #369: URL: https://github.com/apache/yunikorn-k8shim/pull/369#discussion_r840955216
########## File path: test/e2e/recovery_and_restart/recovery_and_restart_test.go ########## @@ -0,0 +1,161 @@ +/* + 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 recoveryandrestart_test + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" + + "github.com/apache/yunikorn-k8shim/test/e2e/framework/configmanager" + "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" + + "github.com/onsi/ginkgo" + "github.com/onsi/gomega" +) + +var _ = ginkgo.Describe("", func() { + var kClient k8s.KubeCtl + var restClient yunikorn.RClient + var oldConfigMap *v1.ConfigMap + var sleepRespPod *v1.Pod + var dev = "dev" + common.RandSeq(5) + + // Define sleepPod + sleepPodConfigs := common.SleepPodConfig{Name: "sleepjob", NS: dev} + sleepPod2Configs := common.SleepPodConfig{Name: "sleepjob2", NS: dev} + + ginkgo.BeforeSuite(func() { + // Initializing kubectl client + kClient = k8s.KubeCtl{} + Ω(kClient.SetClient()).To(gomega.BeNil()) + // Initializing rest client + restClient = yunikorn.RClient{} + + ginkgo.By("Enable basic scheduling config over config maps") + var c, err = kClient.GetConfigMaps(configmanager.YuniKornTestConfig.YkNamespace, + configmanager.DefaultYuniKornConfigMap) + Ω(err).NotTo(gomega.HaveOccurred()) + Ω(c).NotTo(gomega.BeNil()) + + oldConfigMap = c.DeepCopy() + Ω(c).Should(gomega.BeEquivalentTo(oldConfigMap)) + + // Define basic configMap + configStr, err2 := common.CreateBasicConfigMap().ToYAML() + Ω(err2).NotTo(gomega.HaveOccurred()) + + c.Data[configmanager.DefaultPolicyGroup] = configStr + var d, err3 = kClient.UpdateConfigMap(c, configmanager.YuniKornTestConfig.YkNamespace) + Ω(err3).NotTo(gomega.HaveOccurred()) + Ω(d).NotTo(gomega.BeNil()) + + ginkgo.By("create development namespace") + ns1, err := kClient.CreateNamespace(dev, nil) + gomega.Ω(err).NotTo(gomega.HaveOccurred()) + gomega.Ω(ns1.Status.Phase).To(gomega.Equal(v1.NamespaceActive)) + + ginkgo.By("Deploy the sleep pod to the development namespace") + sleepRespPod, err = kClient.CreatePod(common.InitSleepPod(sleepPodConfigs), dev) + gomega.Ω(err).NotTo(gomega.HaveOccurred()) + // Wait for pod to move to running state + err = kClient.WaitForPodBySelectorRunning(dev, + fmt.Sprintf("app=%s", sleepRespPod.ObjectMeta.Labels["app"]), + 10) Review comment: Can change but I kept the 10 seconds to mirror basic_scheduling_test. Even for deployment of the 2nd pod, we are already portforwarding a running scheduler pod. That seems to be the only precondition for running a 10 second wait in the other test. Since the precondition is the same here, do we want to introduce a different timeout value? Happy to change to the suggested 30-60 seconds if you still think it’s a good idea. -- 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]
