})
		Expect(err).NotTo(HaveOccurred())
	})

	AfterEach(func() {
		Expect(srcClique.Stop()).To(Succeed())
		Expect(destClique.Stop()).To(Succeed())
	})

	It("should populate the RTT", func() {
		spec := api.TransferSpec{
			IP:   net.ParseIP("127.0.0.1"),
			Port: destTPort,
			Size: 10 * 1024 * 1024,
		}
		Expect(srcClient.CreateTransfer(spec)).To(Succeed())

		var resList []api.TransferResults
		Eventually(func() []api.TransferResults {
			var err error
			resList, err = srcClient.TransferResultsByIP(net.ParseIP("127.0.0.1"))
			Expect(err).NotTo(HaveOccurred())
			return resList
		}, 5.0).Should(HaveLen(1))

		res := resList[0]
		Expect(res.IP).To(Equal(net.ParseIP("127.0.0.1")))
		Expect(res.RTT).NotTo(BeZero())
		Expect(res.RTT).To(BeNumerically("<", res.Duration))
	})
})
Esempio n. 2
0
						fakeRegistry.TransferResultsByIPArgsForCall(0),
					).To(Equal(ip))
				})
			})

			Describe("POST /transfers", func() {
				var spec api.TransferSpec

				BeforeEach(func() {
					spec = api.TransferSpec{
						IP:   net.ParseIP("12.13.14.15"),
						Port: 1212,
						Size: 10 * 1024 * 1024,
					}
				})

				It("should succeed", func() {
					Expect(client.CreateTransfer(spec)).To(Succeed())
				})

				It("should call the creator with the correct argument", func() {
					client.CreateTransfer(spec)

					Expect(fakeTransferCreator.CreateCallCount()).To(Equal(1))
					Expect(fakeTransferCreator.CreateArgsForCall(0)).To(Equal(spec))
				})
			})
		})
	})
})
Esempio n. 3
0
			var err error
			destTPort = testhelpers.SelectPort(GinkgoParallelNode())
			destClique, err = startClique(config.Config{
				TransferPort: destTPort,
			})
			Expect(err).NotTo(HaveOccurred())
		})

		AfterEach(func() {
			Expect(destClique.Stop()).To(Succeed())
		})

		It("should return list of pending transfers in the transfer source", func() {
			Expect(srcClient.CreateTransfer(api.TransferSpec{
				IP:   net.ParseIP("127.0.0.1"),
				Port: destTPort,
				Size: 10 * 1024 * 1024,
			})).To(Succeed())

			transferState := func() []api.Transfer {
				transfers, err := srcClient.TransfersByState(api.TransferStateRunning)
				Expect(err).NotTo(HaveOccurred())
				return transfers
			}

			// momentarily we see one running task
			Eventually(transferState).Should(HaveLen(1))

			// and then it finishes
			Eventually(transferState).Should(HaveLen(0))
		})