"github.com/onsi/gomega/gbytes" "github.com/onsi/gomega/gexec" ) func init() { if reexec.Init() { os.Exit(0) } } var _ = Describe("Container", func() { var ( netNsName string netNsFd *os.File linkName string configurer *configure.Container logger lager.Logger networkConfig kawasaki.NetworkConfig ) BeforeEach(func() { netNsName = fmt.Sprintf("my-netns-%d", GinkgoParallelNode()) linkName = fmt.Sprintf("my-dummy-link-%d", GinkgoParallelNode()) sess, err := gexec.Start(exec.Command("ip", "netns", "add", netNsName), GinkgoWriter, GinkgoWriter) Expect(err).NotTo(HaveOccurred()) Eventually(sess).Should(gexec.Exit(0)) netNsPath := fmt.Sprintf("/run/netns/%s", netNsName) netNsFd, err = os.Open(netNsPath)
"code.cloudfoundry.org/guardian/kawasaki/devices/fakedevices" "code.cloudfoundry.org/guardian/kawasaki/netns" "code.cloudfoundry.org/lager" "code.cloudfoundry.org/lager/lagertest" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Host", func() { var ( vethCreator *fakedevices.FaveVethCreator linkConfigurer *fakedevices.FakeLink bridger *fakedevices.FakeBridge nsOpener func(path string) (*os.File, error) configurer *configure.Host logger lager.Logger config kawasaki.NetworkConfig ) BeforeEach(func() { vethCreator = &fakedevices.FaveVethCreator{} linkConfigurer = &fakedevices.FakeLink{AddIPReturns: make(map[string]error)} bridger = &fakedevices.FakeBridge{} logger = lagertest.NewTestLogger("test") config = kawasaki.NetworkConfig{} })