Ejemplo n.º 1
0
		AfterEach(func() {
			etcd.Disconnect()
		})

		Describe(".ReadRoutes", func() {
			It("Returns a empty list of routes", func() {
				routes, err := etcd.ReadRoutes()
				Expect(err).NotTo(HaveOccurred())
				Expect(routes).To(Equal([]db.Route{}))
			})

			Context("when only one entry is present", func() {
				BeforeEach(func() {
					route.Route = "next-route"
					route.IP = "9.8.7.6"
					route.Port = 12345

					err := etcd.SaveRoute(route)
					Expect(err).NotTo(HaveOccurred())
				})

				It("Returns a list with one route", func() {
					routes, err := etcd.ReadRoutes()
					Expect(err).NotTo(HaveOccurred())

					Expect(routes).To(ContainElement(route))
				})
			})

			Context("when multiple entries present", func() {
				var (