Esempio n. 1
0
func (t *ConsulHelper) RegisterCell(cell models.CellPresence) {
	jsonBytes, err := models.ToJSON(cell)
	Expect(err).NotTo(HaveOccurred())

	err = t.consulSession.AcquireLock(consul.CellSchemaPath(cell.CellID), jsonBytes)
	Expect(err).NotTo(HaveOccurred())
}
Esempio n. 2
0
						It("retries", func() {
							Expect(cellClient.StopLRPInstanceCallCount()).To(Equal(models.RetireActualLRPRetryAttempts))
						})
					})
				})

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

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

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

	Describe("FailActualLRP", func() {
		var (
			request   models.FailActualLRPRequest
			failErr   *models.Error