})

	Context("when creating the dummy link fails", func() {
		BeforeEach(func() {
			linkFactory.CreateDummyReturns(errors.New("pineapple"))
		})

		It("returns a meaningful error", func() {
			err := startDNS.Execute(context)
			Expect(err).To(MatchError("namespace execute: create dummy: pineapple"))
		})
	})

	Context("when adding the address fails", func() {
		BeforeEach(func() {
			addressManager.AddAddressReturns(errors.New("pineapple"))
		})

		It("returns a meaningful error", func() {
			err := startDNS.Execute(context)
			Expect(err).To(MatchError("namespace execute: add address: pineapple"))
		})
	})

	Context("when setting the link up fails", func() {
		BeforeEach(func() {
			linkFactory.SetUpReturns(errors.New("pineapple"))
		})

		It("returns a meaningful error", func() {
			err := startDNS.Execute(context)
		}
	})

	It("adds the address to the interface", func() {
		err := addAddress.Execute(context)
		Expect(err).NotTo(HaveOccurred())

		Expect(addressManager.AddAddressCallCount()).To(Equal(1))
		interfaceName, address := addressManager.AddAddressArgsForCall(0)
		Expect(interfaceName).To(Equal("my-interface"))
		Expect(address.String()).To(Equal("192.168.1.1/24"))
	})

	Context("when adding the address fails", func() {
		BeforeEach(func() {
			addressManager.AddAddressReturns(errors.New("no address for you"))
		})

		It("wraps and propagates the error", func() {
			err := addAddress.Execute(context)
			Expect(err).To(MatchError("add address: no address for you"))
		})
	})

	Describe("String", func() {
		It("describes itself", func() {
			Expect(addAddress.String()).To(Equal("ip addr add 192.168.1.1/24 dev my-interface"))
		})
	})
})