func NewDefaultConfigurer(ipt *iptables.IPTablesController) kawasaki.Configurer { resolvConfigurer := &kawasaki.ResolvConfigurer{ HostsFileCompiler: &dns.HostsFileCompiler{}, ResolvFileCompiler: &dns.ResolvFileCompiler{}, FileWriter: &dns.RootfsWriter{}, IDMapReader: &kawasaki.RootIdMapReader{}, } hostConfigurer := &configure.Host{ Veth: &devices.VethCreator{}, Link: &devices.Link{}, Bridge: &devices.Bridge{}, FileOpener: netns.Opener(os.Open), } containerConfigurer := &configure.Container{ FileOpener: netns.Opener(os.Open), } return kawasaki.NewConfigurer( resolvConfigurer, hostConfigurer, containerConfigurer, iptables.NewInstanceChainCreator(ipt), ) }
) BeforeEach(func() { var err error fakeRunner = fake_command_runner.New() logger = lagertest.NewTestLogger("test") handle = "some-handle-that-is-longer-than-29-characters-long" bridgeName = "some-bridge" ip, network, err = net.ParseCIDR("1.2.3.4/28") Expect(err).NotTo(HaveOccurred()) fakeLocksmith := NewFakeLocksmith() creator = iptables.NewInstanceChainCreator( iptables.New("/sbin/iptables", "/sbin/iptables-restore", fakeRunner, fakeLocksmith, "prefix-"), ) }) Describe("Container Creation", func() { var specs []fake_command_runner.CommandSpec BeforeEach(func() { specs = []fake_command_runner.CommandSpec{ { Path: "/sbin/iptables", Args: []string{"--wait", "--table", "nat", "-N", "prefix-instance-some-id"}, }, { Path: "iptables", Args: []string{"--wait", "--table", "nat", "-A", "prefix-prerouting",