Ejemplo n.º 1
0
					res = []api.TransferResults{
						api.TransferResults{
							IP:        net.ParseIP("12.12.12.13"),
							BytesSent: 1024,
							Checksum:  124566,
							Duration:  time.Second * 12,
							RTT:       time.Millisecond * 19,
							Time:      t,
						},
					}
					fakeRegistry.TransferResultsByIPReturns(res)
				})

				It("should return the registry results", func() {
					recvRes, err := client.TransferResultsByIP(net.ParseIP("12.12.12.13"))
					Expect(err).NotTo(HaveOccurred())

					Expect(recvRes).To(Equal(res))
				})

				It("should call the registry with the correct argument", func() {
					ip := net.ParseIP("12.12.12.13")

					client.TransferResultsByIP(ip)

					Expect(
						fakeRegistry.TransferResultsByIPCallCount(),
					).To(Equal(1))
					Expect(
						fakeRegistry.TransferResultsByIPArgsForCall(0),
Ejemplo n.º 2
0
		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))
	})
})