github.com/chenbh/concourse/v6@v6.4.2/testflight/caching_test.go (about)

     1  package testflight_test
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo"
     5  	. "github.com/onsi/gomega"
     6  	"github.com/onsi/gomega/gbytes"
     7  	"github.com/onsi/gomega/gexec"
     8  )
     9  
    10  var _ = Describe("Resource caching", func() {
    11  	BeforeEach(func() {
    12  		setAndUnpausePipeline("fixtures/caching.yml")
    13  	})
    14  
    15  	It("does not fetch if there is nothing new", func() {
    16  		someResourceV1 := newMockVersion("some-resource", "some1")
    17  		cachedResourceV1 := newMockVersion("cached-resource", "cached1")
    18  
    19  		By("initially fetching twice")
    20  		watch := fly("trigger-job", "-j", inPipeline("some-passing-job"), "-w")
    21  		Expect(watch).To(gbytes.Say("fetching.*" + someResourceV1))
    22  		Expect(watch).To(gbytes.Say("fetching.*" + cachedResourceV1))
    23  		Expect(watch).To(gbytes.Say("succeeded"))
    24  
    25  		By("coming up with a new version for one resource")
    26  		someResourceV2 := newMockVersion("some-resource", "some2")
    27  
    28  		By("hitting the cache for the original version and fetching the new one")
    29  		watch = fly("trigger-job", "-j", inPipeline("some-passing-job"), "-w")
    30  		Expect(watch).To(gbytes.Say("fetching.*" + someResourceV2))
    31  		Expect(watch).NotTo(gbytes.Say("fetching"))
    32  		Expect(watch).To(gbytes.Say("succeeded"))
    33  		Expect(watch).To(gexec.Exit(0))
    34  	})
    35  })