github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/topgun/runtime/worker_failing_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 failing", func() {
    11  	BeforeEach(func() {
    12  		Deploy(
    13  			"deployments/concourse.yml",
    14  			"-o", "operations/add-other-worker.yml",
    15  			"-o", "operations/other-worker-doomed.yml",
    16  			"-o", "operations/fast-gc.yml",
    17  		)
    18  	})
    19  
    20  	Context("when the worker becomes unresponsive", func() {
    21  		BeforeEach(func() {
    22  			By("setting a pipeline that uses the doomed worker")
    23  			Fly.Run("set-pipeline", "-n", "-c", "pipelines/controlled-trigger-doomed-worker.yml", "-p", "worker-failing-test")
    24  			Fly.Run("unpause-pipeline", "-p", "worker-failing-test")
    25  
    26  			By("running the build on the doomed worker")
    27  			Fly.Run("trigger-job", "-w", "-j", "worker-failing-test/use-doomed-worker")
    28  
    29  			By("making baggageclaim become unresponsive on the doomed worker")
    30  			Bosh("ssh", "other_worker/0", "-c", "sudo pkill -F /var/vcap/sys/run/worker/worker.pid -STOP")
    31  
    32  			By("discovering a new version to force the existing volume to be no longer desired")
    33  			Fly.Run("check-resource", "-r", "worker-failing-test/controlled-trigger", "-f", "version:second")
    34  		})
    35  
    36  		AfterEach(func() {
    37  			Bosh("ssh", "other_worker/0", "-c", "sudo pkill -F /var/vcap/sys/run/worker/worker.pid -CONT")
    38  			WaitForWorkersToBeRunning(2)
    39  		})
    40  
    41  		It("puts the worker in stalled state and does not lock up garbage collection", func() {
    42  			By("waiting for the doomed worker to stall")
    43  			Eventually(WaitForStalledWorker()).ShouldNot(BeEmpty())
    44  
    45  			By("running the build on the safe worker")
    46  			Fly.Run("trigger-job", "-w", "-j", "worker-failing-test/use-safe-worker")
    47  
    48  			By("having a cache for the controlled-trigger resource")
    49  			Expect(VolumesByResourceType("mock")).ToNot(BeEmpty())
    50  
    51  			By("discovering a new version force the existing volume on the safe worker to be no longer desired")
    52  			Fly.Run("check-resource", "-r", "worker-failing-test/controlled-trigger", "-f", "version:third")
    53  
    54  			By("eventually garbage collecting the volume from the safe worker")
    55  			Eventually(func() []string {
    56  				return VolumesByResourceType("mock")
    57  			}).Should(BeEmpty())
    58  		})
    59  	})
    60  })