BeforeEach(func() { sbox.VethDeviceCountReturns(1, nil) }) It("does NOT destroy the namespace", func() { err := cleanupSandboxCommand.Execute(context) Expect(err).NotTo(HaveOccurred()) Expect(sandboxRepo.DestroyCallCount()).To(Equal(0)) }) It("does NOT destroy the vxlan device", func() { err := cleanupSandboxCommand.Execute(context) Expect(err).NotTo(HaveOccurred()) Expect(linkFactory.DeleteLinkByNameCallCount()).To(Equal(0)) }) It("does NOT destroy the sandbox", func() { err := cleanupSandboxCommand.Execute(context) Expect(err).NotTo(HaveOccurred()) Expect(sandboxRepo.DestroyCallCount()).To(Equal(0)) }) }) Context("when there are no veth devices in the sandbox", func() { It("removes the vxlan device in the sandbox namespace", func() { sandboxNS.ExecuteStub = func(callback func(ns *os.File) error) error { Expect(linkFactory.DeleteLinkByNameCallCount()).To(Equal(0)) err := callback(nil)