ContainerNamespace: containerNamespace.Name(), ContainerID: containerID, } By("adding the container to a network") 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()) })