Describe("SetNamespace", func() {
			var link netlink.Link

			BeforeEach(func() {
				link = &netlink.Dummy{}
				netlinker.LinkByNameReturns(link, nil)
			})

			It("associates the link with a file descriptor", func() {
				err := factory.SetNamespace("link-name", 99)
				Expect(err).NotTo(HaveOccurred())

				Expect(netlinker.LinkByNameCallCount()).To(Equal(1))
				Expect(netlinker.LinkByNameArgsForCall(0)).To(Equal("link-name"))

				Expect(netlinker.LinkSetNsFdCallCount()).To(Equal(1))

				l, fd := netlinker.LinkSetNsFdArgsForCall(0)
				Expect(l).To(Equal(link))
				Expect(fd).To(Equal(99))
			})

			Context("when finding the link fails", func() {
				BeforeEach(func() {
					netlinker.LinkByNameReturns(nil, errors.New("no link for you"))
				})

				It("returns a meaningful error", func() {
					err := factory.SetNamespace("link-name", 99)
					Expect(err).To(MatchError("failed to find link: no link for you"))
				})