}) Describe("DeleteLink", func() { It("deletes the link", func() { link := &netlink.Dummy{} err := factory.DeleteLink(link) Expect(err).NotTo(HaveOccurred()) Expect(netlinker.LinkDelCallCount()).To(Equal(1)) Expect(netlinker.LinkDelArgsForCall(0)).To(Equal(link)) }) Context("when netlink LinkDel fails", func() { BeforeEach(func() { netlinker.LinkDelReturns(errors.New("link del failed")) }) It("returns the error", func() { link := &netlink.Dummy{} err := factory.DeleteLink(link) Expect(err).To(MatchError("link del failed")) }) }) }) Describe("DeleteLinkByName", func() { var expectedLink netlink.Link BeforeEach(func() { expectedLink = &netlink.Dummy{}