var expectedBridge *netlink.Bridge BeforeEach(func() { expectedBridge = &netlink.Bridge{ LinkAttrs: netlink.LinkAttrs{ Name: "some-bridge-name", MTU: links.BridgeMTU, }, } }) It("adds the bridge", func() { err := factory.CreateBridge("some-bridge-name") Expect(err).NotTo(HaveOccurred()) Expect(netlinker.LinkAddCallCount()).To(Equal(1)) Expect(netlinker.LinkAddArgsForCall(0)).To(Equal(expectedBridge)) }) Context("when adding the bridge link fails", func() { It("returns the error", func() { netlinker.LinkAddReturns(errors.New("link add failed")) err := factory.CreateBridge("some-bridge-name") Expect(err).To(Equal(errors.New("link add failed"))) }) }) }) Describe("CreateDummy", func() { var expectedDummy *netlink.Dummy