Example #1
0
func registerCell(cell models.CellPresence) {
	var err error
	jsonBytes, err := json.Marshal(cell)
	Expect(err).NotTo(HaveOccurred())

	_, err = consulSession.SetPresence(bbs.CellSchemaPath(cell.CellID), jsonBytes)
	Expect(err).NotTo(HaveOccurred())
}
Example #2
0
						It("retries", func() {
							Expect(fakeRepClient.StopLRPInstanceCallCount()).To(Equal(models.RetireActualLRPRetryAttempts))
						})
					})
				})

				Context("is not present", func() {
					It("removes the LRPs", func() {
						_, err := storeClient.Get(ActualLRPSchemaPath(lrpKey.ProcessGuid, lrpKey.Index), false, true)
						Expect(err).To(HaveOccurred())
					})
				})

				Context("cannot be retrieved", func() {
					BeforeEach(func() {
						_, err := consulSession.SetPresence(bbs.CellSchemaPath(cellID), []byte("abcd"))
						Expect(err).NotTo(HaveOccurred())
					})

					It("does not stop the instances", func() {
						Expect(fakeRepClient.StopLRPInstanceCallCount()).To(Equal(0))
					})
				})
			})
		})
	})

	Describe("FailActualLRP", func() {
		var (
			failErr   error
			actualLRP *models.ActualLRP
Example #3
0
		etcdRunner.Start()
		consulRunner.Start()
		consulRunner.WaitUntilReady()

		bbsProcess = ginkgomon.Invoke(bbsrunner.New(binPaths.Bbs, bbsArgs))
		bbsClient = bbs.NewClient(fmt.Sprint("http://", bbsArgs.Address))

		consulSession = consulRunner.NewSession("a-session")

		capacity := models.NewCellCapacity(512, 1024, 124)
		cellPresence := models.NewCellPresence("the-cell-id", "1.2.3.4", "the-zone", capacity, []string{}, []string{})

		value, err := json.Marshal(cellPresence)
		Expect(err).NotTo(HaveOccurred())

		_, err = consulSession.SetPresence(bbs.CellSchemaPath(cellPresence.CellID), value)
		Expect(err).NotTo(HaveOccurred())

	})

	AfterEach(func() {
		ginkgomon.Kill(bbsProcess)
		ginkgomon.Kill(convergerProcess)
		consulRunner.Stop()
		etcdRunner.Stop()
	})

	startConverger := func() {
		runner = convergerrunner.New(convergerConfig)
		convergerProcess = ginkgomon.Invoke(runner)
		time.Sleep(convergeRepeatInterval)