Describe("Get", func() {
		var repo namespace.Repository

		BeforeEach(func() {
			var err error
			repo, err = namespace.NewRepository(logger, repoDir, threadLocker)
			Expect(err).NotTo(HaveOccurred())
		})

		It("returns the correct namespace", func() {
			ns, err := repo.Create("some-namespace")
			Expect(err).NotTo(HaveOccurred())
			defer repo.Destroy(ns)

			nsFromGet, err := repo.Get("some-namespace")
			Expect(err).NotTo(HaveOccurred())

			Expect(ns.Name()).To(Equal(nsFromGet.Name()))

			err = nsFromGet.Execute(func(*os.File) error { return nil })
			Expect(err).NotTo(HaveOccurred())
		})

		Context("when the namespace file does not exist", func() {
			It("returns ErrNotExist", func() {
				_, err := repo.Get("test-ns")
				Expect(err).To(HaveOccurred())
				Expect(os.IsNotExist(err)).To(BeTrue())
			})
			var err error
			ipamResult, err = daemonClient.ContainerUp(upSpec)
			Expect(err).NotTo(HaveOccurred())
		})

		AfterEach(func() {
			By("removing the container from the network")
			Expect(daemonClient.ContainerDown(downSpec)).To(Succeed())

			By("checking that containers have been removed")
			containers, err := daemonClient.ListNetworkContainers(networkID)
			Expect(err).NotTo(HaveOccurred())
			Expect(containers).To(HaveLen(0))

			By("checking that the sandbox has been cleaned up")
			_, err = sandboxRepo.Get(sandboxName)
			Expect(err).To(MatchError(ContainSubstring("no such file or directory")))

			By("checking that the veth device is no longer in the container")
			err = containerNamespace.Execute(func(_ *os.File) error {
				_, err := netlink.LinkByName("vx-eth0")
				Expect(err).To(MatchError(ContainSubstring("Link not found")))
				return nil
			})
			Expect(err).NotTo(HaveOccurred())
		})

		It("makes container metadata available on the list network containers endpoint", func() {
			containers, err := daemonClient.ListNetworkContainers(networkID)
			Expect(err).NotTo(HaveOccurred())