示例#1
0
				Expect(found).To(BeTrue())
			})
		})

		Context("when the interface does not exist", func() {
			It("does not return an error", func() {
				_, found, err := l.InterfaceByName("sandwich")
				Expect(err).ToNot(HaveOccurred())
				Expect(found).To(BeFalse())
			})
		})
	})

	Describe("List", func() {
		It("lists all the interfaces", func() {
			names, err := l.List()
			Expect(err).ToNot(HaveOccurred())

			Expect(names).To(ContainElement(name))
		})
	})

	Describe("Statistics", func() {

		Context("When the interface exist", func() {
			BeforeEach(func() {
				cmd, err := gexec.Start(exec.Command(
					"sh", "-c", `
					ip netns add netns1
					ip link add veth0 type veth peer name veth1
					ip link set veth1 netns netns1