Ejemplo n.º 1
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)
Ejemplo n.º 2
0
			Expect(err).NotTo(HaveOccurred())
		})

		Context("when there are keys", func() {
			var bsession *consuladapter.Session

			BeforeEach(func() {
				bsession = clusterRunner.NewSession("bsession")
			})

			AfterEach(func() {
				bsession.Destroy()
			})

			It("detects removals of keys", func() {
				_, err := bsession.SetPresence("under/here", []byte("value"))
				Expect(err).NotTo(HaveOccurred())

				bsession.Destroy()

				Eventually(disappearChan).Should(Receive(Equal([]string{"under/here"})))
			})

			Context("with other prefixes", func() {
				BeforeEach(func() {
					_, err := bsession.SetPresence("other", []byte("value"))
					Expect(err).NotTo(HaveOccurred())
				})

				It("does not detect removal of keys under other prefixes", func() {
					bsession.Destroy()