Exemplo n.º 1
0
		BeforeEach(func() {
			reconnectedConnection = fake_connection.New()

			connectionProvider = &ManyConnectionProvider{
				Connections: []connection.Connection{
					fakeConnection,
					reconnectedConnection,
				},
			}
		})

		It("reconnects", func() {
			_, err := client.Create(warden.ContainerSpec{})
			Ω(err).ShouldNot(HaveOccurred())

			Ω(fakeConnection.Created()).Should(HaveLen(1))

			_, err = client.Create(warden.ContainerSpec{})
			Ω(err).ShouldNot(HaveOccurred())

			Ω(fakeConnection.Created()).Should(HaveLen(2))

			fakeConnection.NotifyDisconnected()

			_, err = client.Create(warden.ContainerSpec{})
			Ω(err).ShouldNot(HaveOccurred())

			Ω(reconnectedConnection.Created()).Should(HaveLen(1))
		})
	})