Exemplo n.º 1
0
				Expect(veth.Attrs().Name).To(Equal("host"))
				Expect(veth.Attrs().MTU).To(Equal(999))
				Expect(veth.PeerName).To(Equal("container"))
			})

			It("retrieves the host link data after creating the pair", func() {
				netlinker.LinkByNameStub = func(_ string) (netlink.Link, error) {
					Expect(netlinker.LinkAddCallCount()).To(Equal(1))
					return &netlink.Veth{}, nil
				}

				_, _, err := factory.CreateVethPair("container", "host", 999)
				Expect(err).NotTo(HaveOccurred())

				Expect(netlinker.LinkByNameCallCount()).To(Equal(1))
				Expect(netlinker.LinkByNameArgsForCall(0)).To(Equal("container"))
			})

			It("returns the container link that was added", func() {
				_, container, err := factory.CreateVethPair("container", "host", 999)
				Expect(err).NotTo(HaveOccurred())

				Expect(netlinker.LinkAddCallCount()).To(Equal(1))
				addedLink := netlinker.LinkAddArgsForCall(0)
				Expect(container).To(Equal(addedLink))
			})

			It("returns the host link that was retrieved", func() {
				expectedHostLink := &netlink.Veth{
					LinkAttrs: netlink.LinkAttrs{