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{ Name: "host", MTU: 999, }, PeerName: "container", } netlinker.LinkByNameReturns(expectedHostLink, nil) host, _, err := factory.CreateVethPair("container", "host", 999) Expect(err).NotTo(HaveOccurred()) Expect(netlinker.LinkByNameCallCount()).To(Equal(1)) Expect(host).To(Equal(expectedHostLink)) }) Context("when a really long containerName is passed in", func() { It("should concatenate to 11 characters", func() { _, _, err := factory.CreateVethPair("really-long-name", "host", 999) Expect(err).NotTo(HaveOccurred()) Expect(netlinker.LinkByNameCallCount()).To(Equal(1)) Expect(netlinker.LinkByNameArgsForCall(0)).To(Equal("really-long"))