ns.ExecuteStub = func(callback func(_ *os.File) error) error {
				if ns.ExecuteCallCount() == 1 {
					Expect(netlinker.LinkByNameCallCount()).To(Equal(0))
				}
				callback(nil)
				if ns.ExecuteCallCount() == 1 {
					Expect(netlinker.LinkByNameCallCount()).To(Equal(1))
				}
				return nil
			}

			inserter.HandleResolvedNeighbors(ready, ns, "some-vxlan-name", resolved)
			Eventually(ready).Should(BeClosed())

			Expect(ns.ExecuteCallCount()).To(Equal(2))
			Expect(netlinker.LinkByNameArgsForCall(0)).To(Equal("some-vxlan-name"))
		})

		Context("when the vxlan device cannot be found", func() {
			BeforeEach(func() {
				netlinker.LinkByNameReturns(nil, errors.New("boom-boom"))
			})

			It("returns a meaningful error", func() {
				inserter.HandleResolvedNeighbors(ready, ns, "some-vxlan-name", resolved)
				Eventually(ready).Should(Receive(MatchError(`namespace execute failed: find link "some-vxlan-name": boom-boom`)))
			})
		})

		It("sets a neighbor entry in the sandbox namespace", func() {
			ns.ExecuteStub = func(callback func(ns *os.File) error) error {
					_, err := factory.FindLink("some-device-name")
					Expect(err).To(Equal(errors.New("not found")))
				})
			})
		})

		Describe("Exists", func() {
			Context("when a link is found", func() {
				BeforeEach(func() {
					netlinker.LinkByNameReturns(&netlink.Vxlan{VxlanId: 41}, nil)
				})

				It("returns true", func() {
					Expect(factory.Exists("some-device-name")).To(BeTrue())
					Expect(netlinker.LinkByNameCallCount()).To(Equal(1))
					Expect(netlinker.LinkByNameArgsForCall(0)).To(Equal("some-device-name"))
				})
			})

			Context("when link by name returns an error", func() {
				BeforeEach(func() {
					netlinker.LinkByNameReturns(nil, errors.New("not found"))
				})

				It("returns false", func() {
					Expect(factory.Exists("some-device-name")).To(BeFalse())
					Expect(netlinker.LinkByNameCallCount()).To(Equal(1))
					Expect(netlinker.LinkByNameArgsForCall(0)).To(Equal("some-device-name"))
				})
			})
		})
		BeforeEach(func() {
			address = &net.IPNet{
				IP:   net.ParseIP("192.168.1.1"),
				Mask: net.CIDRMask(24, 32),
			}

			link = &netlink.Veth{}
			netlinker.LinkByNameReturns(link, nil)
		})

		It("finds the link by name", func() {
			err := addressManager.AddAddress("my-link", address)
			Expect(err).NotTo(HaveOccurred())

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

		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 := addressManager.AddAddress("my-link", address)
				Expect(err).To(MatchError("link by name failed: no link for you"))
			})
		})

		It("adds an address to the link", func() {
			err := addressManager.AddAddress("my-link", address)