Beispiel #1
0
		calls := 0

		return func() (atc.Config, db.ConfigVersion, bool, error) {
			if calls == 1 {
				return atc.Config{}, 0, found, err
			}

			calls += 1

			return initialConfig, 1, true, nil
		}
	}

	Context("when the pipeline is destroyed", func() {
		BeforeEach(func() {
			pipelineDB.GetConfigStub = failingGetConfigStubWith(false, nil)
		})

		It("exits", func() {
			Eventually(process.Wait()).Should(Receive())
		})
	})

	Context("when getting the config fails for some other reason", func() {
		BeforeEach(func() {
			pipelineDB.GetConfigStub = failingGetConfigStubWith(false, errors.New("idk lol"))
		})

		It("keeps on truckin'", func() {
			Eventually(pipelineDB.GetConfigCallCount).Should(BeNumerically(">=", 2))
		})
Beispiel #2
0
		calls := 0

		return func() (atc.Config, db.ConfigVersion, error) {
			if calls == 1 {
				return atc.Config{}, 0, db.ErrPipelineNotFound
			}

			calls += 1

			return initialConfig, 1, nil
		}
	}

	Context("when the pipeline is destroyed", func() {
		BeforeEach(func() {
			pipelineDB.GetConfigStub = failingGetConfigStubWith(db.ErrPipelineNotFound)
		})

		It("exits", func() {
			Eventually(process.Wait()).Should(Receive())
		})
	})

	Context("when getting the config fails for some other reason", func() {
		BeforeEach(func() {
			pipelineDB.GetConfigStub = failingGetConfigStubWith(errors.New("idk lol"))
		})

		It("keeps on truckin'", func() {
			Eventually(pipelineDB.GetConfigCallCount).Should(BeNumerically(">=", 2))
		})
Beispiel #3
0
		Ω(resource).Should(Equal("some-other-resource"))
	})

	Context("when new resources are configured", func() {
		var updateConfig chan<- atc.Config

		BeforeEach(func() {
			configs := make(chan atc.Config)
			updateConfig = configs

			config := initialConfig

			pipelineDB.GetConfigStub = func() (atc.Config, db.ConfigVersion, error) {
				select {
				case config = <-configs:
				default:
				}

				return config, 1, nil
			}
		})

		It("scans for them eventually", func() {
			Eventually(scannerFactory.ScannerCallCount).Should(Equal(2))

			_, resource := scannerFactory.ScannerArgsForCall(0)
			Ω(resource).Should(Equal("some-resource"))

			_, resource = scannerFactory.ScannerArgsForCall(1)
			Ω(resource).Should(Equal("some-other-resource"))

			newConfig := initialConfig