コード例 #1
0
		}
	})

	It("uses the link factory to create the veth pair", func() {
		err := createVeth.Execute(context)
		Expect(err).NotTo(HaveOccurred())

		name, peerName, mtu := linkFactory.CreateVethArgsForCall(0)
		Expect(name).To(Equal("if-name"))
		Expect(peerName).To(Equal("peer-if-name"))
		Expect(mtu).To(Equal(99))
	})

	Context("when creating the link fails", func() {
		BeforeEach(func() {
			linkFactory.CreateVethReturns(errors.New("welp"))
		})

		It("wraps and propogates the error", func() {
			err := createVeth.Execute(context)
			Expect(err).To(MatchError("create veth: welp"))
		})
	})

	Describe("String", func() {
		It("is self describing", func() {
			Expect(createVeth.String()).To(Equal("ip link add dev if-name mtu 99 type veth peer name peer-if-name mtu 99"))
		})
	})
})