Expect(executor.ExecuteCallCount()).To(Equal(1)) Expect(executor.ExecuteArgsForCall(0)).To(Equal( commands.All( commands.InNamespace{ Namespace: containerNS, Command: commands.DeleteLink{ LinkName: "some-interface-name", }, }, commands.CleanupSandbox{ SandboxName: "sandbox-name", VxlanDeviceName: "some-vxlan", }, ), )) }) Context("when executing fails", func() { BeforeEach(func() { executor.ExecuteReturns(errors.New("boom")) }) It("should return the error", func() { err := deletor.Delete("some-interface-name", "/path/to/container/namespace", "sandbox-name", "some-vxlan") Expect(err).To(MatchError("boom")) }) }) })
_, err := creator.Setup(config) Expect(err).NotTo(HaveOccurred()) Expect(ex.ExecuteCallCount()).To(Equal(3)) Expect(ex.ExecuteArgsForCall(0)).To(Equal(createSandboxResult)) sandboxName, vxlanName, vni, dnsAddress := commandBuilder.IdempotentlyCreateSandboxArgsForCall(0) Expect(sandboxName).To(Equal("vni-99")) Expect(vxlanName).To(Equal("vxlan99")) Expect(vni).To(Equal(99)) Expect(dnsAddress).To(Equal("some-dns-address")) }) Context("when creating the sandbox errors", func() { It("should return a meaningful error", func() { ex.ExecuteReturns(errors.New("potato")) _, err := creator.Setup(config) Expect(err).To(MatchError("executing command: create sandbox: potato")) }) }) It("should get the sandbox ns from the sandbox repo", func() { _, err := creator.Setup(config) Expect(err).NotTo(HaveOccurred()) Expect(sandboxRepo.GetCallCount()).To(Equal(1)) Expect(sandboxRepo.GetArgsForCall(0)).To(Equal("vni-99")) }) Context("when getting the sandbox ns from the sandbox repo fails", func() {