)

var _ = Describe("Delete", func() {
	var (
		deletor         container.Deletor
		executor        *fakes.Executor
		containerNS     namespace.Namespace
		namespaceOpener *fakes.Opener
	)

	BeforeEach(func() {
		executor = &fakes.Executor{}

		namespaceOpener = &fakes.Opener{}
		containerNS = &fakes.Namespace{NameStub: func() string { return "container ns sentinel" }}
		namespaceOpener.OpenPathReturns(containerNS, nil)

		deletor = container.Deletor{
			Executor:        executor,
			NamespaceOpener: namespaceOpener,
		}
	})

	It("should open the container namespace", func() {
		err := deletor.Delete("some-interface-name", "/path/to/container/namespace", "sandbox-name", "some-vxlan")
		Expect(err).NotTo(HaveOccurred())
		Expect(namespaceOpener.OpenPathCallCount()).To(Equal(1))
		Expect(namespaceOpener.OpenPathArgsForCall(0)).To(Equal("/path/to/container/namespace"))
	})

	Context("when opening the container namespace fails", func() {