github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/topgun/k8s/ephemeral_worker_test.go (about) 1 package k8s_test 2 3 import ( 4 "fmt" 5 "time" 6 7 . "github.com/pf-qiu/concourse/v6/topgun" 8 . "github.com/onsi/ginkgo" 9 . "github.com/onsi/gomega" 10 ) 11 12 var _ = Describe("Ephemeral workers", func() { 13 14 var atc Endpoint 15 16 BeforeEach(func() { 17 setReleaseNameAndNamespace("ew") 18 19 deployConcourseChart(releaseName, 20 // TODO: https://github.com/pf-qiu/concourse/v6/issues/2827 21 "--set=concourse.web.gc.interval=300ms", 22 "--set=concourse.web.tsa.heartbeatInterval=300ms", 23 "--set=worker.replicas=1", 24 "--set=concourse.worker.baggageclaim.driver=overlay") 25 26 atc = waitAndLogin(namespace, releaseName+"-web") 27 }) 28 29 AfterEach(func() { 30 cleanupReleases() 31 atc.Close() 32 }) 33 34 It("Gets properly cleaned when getting removed and then put back on", func() { 35 deletePods(releaseName, fmt.Sprintf("--selector=app=%s-worker", releaseName)) 36 37 Eventually(func() (runningWorkers []Worker) { 38 workers := fly.GetWorkers() 39 for _, w := range workers { 40 Expect(w.State).ToNot(Equal("stalled"), "the worker should never stall") 41 if w.State == "running" { 42 runningWorkers = append(runningWorkers, w) 43 } 44 } 45 return 46 }, 1*time.Minute, 1*time.Second).Should(HaveLen(0), "the running worker should go away") 47 }) 48 })