github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/topgun/both/worker_retiring_test.go (about)

     1  package topgun_test
     2  
     3  import (
     4  	. "github.com/pf-qiu/concourse/v6/topgun/common"
     5  	_ "github.com/lib/pq"
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = Describe("Worker retiring", func() {
    11  	BeforeEach(func() {
    12  		Deploy("deployments/concourse.yml")
    13  	})
    14  
    15  	It("deletes all containers and volumes when worker is gone", func() {
    16  		By("setting pipeline that creates resource cache")
    17  		Fly.Run("set-pipeline", "-n", "-c", "pipelines/get-task.yml", "-p", "worker-retiring-test")
    18  
    19  		By("unpausing the pipeline")
    20  		Fly.Run("unpause-pipeline", "-p", "worker-retiring-test")
    21  
    22  		By("checking resource")
    23  		Fly.Run("check-resource", "-r", "worker-retiring-test/tick-tock")
    24  
    25  		By("getting the worker containers")
    26  		containersBefore := FlyTable("containers")
    27  		Expect(containersBefore).To(HaveLen(1))
    28  
    29  		By("getting the worker volumes")
    30  		volumesBefore := FlyTable("volumes")
    31  		Expect(volumesBefore).ToNot(BeEmpty())
    32  
    33  		By("retiring the worker")
    34  		Deploy("deployments/concourse.yml", "-o", "operations/retire-worker.yml")
    35  
    36  		By("getting the worker containers")
    37  		containersAfter := FlyTable("containers")
    38  		Expect(containersAfter).To(HaveLen(0))
    39  
    40  		By("getting the worker volumes")
    41  		volumesAfter := FlyTable("volumes")
    42  		Expect(volumesAfter).To(HaveLen(0))
    43  	})
    44  })