Skip to content

Commit 3e97e2d

Browse files
committed
test/e2e: Remove slirp
Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent 9d37da5 commit 3e97e2d

File tree

6 files changed

+2
-186
lines changed

6 files changed

+2
-186
lines changed

test/e2e/containers_conf_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,6 @@ var _ = Describe("Verify podman containers.conf usage", func() {
379379
Expect(session.OutputToString()).To(Equal("0002"))
380380
})
381381

382-
It("network slirp options to allow host loopback", func() {
383-
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns", ALPINE, "ping", "-c1", "10.0.2.2"})
384-
session.Wait(30)
385-
Expect(session).Should(ExitCleanly())
386-
})
387-
388382
It("podman-remote test localcontainers.conf", func() {
389383
SkipIfNotRemote("this test is only for remote")
390384

@@ -749,7 +743,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
749743
It("podman default_rootless_network_cmd", func() {
750744
SkipIfNotRootless("default_rootless_network_cmd is only used rootless")
751745

752-
for _, mode := range []string{"pasta", "slirp4netns", "invalid"} {
746+
for _, mode := range []string{"pasta", "invalid"} {
753747
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
754748
content := "[network]\ndefault_rootless_network_cmd=\"" + mode + "\"\n"
755749
err := os.WriteFile(conffile, []byte(content), 0o755)

test/e2e/network_connect_disconnect_test.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
3131
Expect(dis).Should(ExitWithError(125, `no container with name or ID "foobar" found: no such container`))
3232
})
3333

34-
It("network disconnect with net mode slirp4netns should result in error", func() {
35-
netName := "slirp" + stringid.GenerateRandomID()
36-
session := podmanTest.Podman([]string{"network", "create", netName})
37-
session.WaitWithDefaultTimeout()
38-
Expect(session).Should(ExitCleanly())
39-
defer podmanTest.removeNetwork(netName)
40-
41-
session = podmanTest.Podman([]string{"create", "--name", "test", "--network", "slirp4netns", ALPINE})
42-
session.WaitWithDefaultTimeout()
43-
Expect(session).Should(ExitCleanly())
44-
defer podmanTest.removeNetwork(netName)
45-
46-
con := podmanTest.Podman([]string{"network", "disconnect", netName, "test"})
47-
con.WaitWithDefaultTimeout()
48-
Expect(con).Should(ExitWithError(125, `"slirp4netns" is not supported: invalid network mode`))
49-
})
50-
5134
It("podman network disconnect", func() {
5235
netName := "aliasTest" + stringid.GenerateRandomID()
5336
session := podmanTest.Podman([]string{"network", "create", netName})
@@ -120,23 +103,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
120103
Expect(dis).Should(ExitWithError(125, `no container with name or ID "foobar" found: no such container`))
121104
})
122105

123-
It("network connect with net mode slirp4netns should result in error", func() {
124-
netName := "slirp" + stringid.GenerateRandomID()
125-
session := podmanTest.Podman([]string{"network", "create", netName})
126-
session.WaitWithDefaultTimeout()
127-
Expect(session).Should(ExitCleanly())
128-
defer podmanTest.removeNetwork(netName)
129-
130-
session = podmanTest.Podman([]string{"create", "--name", "test", "--network", "slirp4netns", ALPINE})
131-
session.WaitWithDefaultTimeout()
132-
Expect(session).Should(ExitCleanly())
133-
defer podmanTest.removeNetwork(netName)
134-
135-
con := podmanTest.Podman([]string{"network", "connect", netName, "test"})
136-
con.WaitWithDefaultTimeout()
137-
Expect(con).Should(ExitWithError(125, `"slirp4netns" is not supported: invalid network mode`))
138-
})
139-
140106
It("podman connect on a container that already is connected to the network should error after init", func() {
141107
netName := "aliasTest" + stringid.GenerateRandomID()
142108
session := podmanTest.Podman([]string{"network", "create", netName})

test/e2e/network_create_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ var _ = Describe("Podman network create", func() {
561561
})
562562

563563
It("podman network create with invalid name", func() {
564-
for _, name := range []string{"none", "host", "bridge", "private", "slirp4netns", "pasta", "container", "ns", "default"} {
564+
for _, name := range []string{"none", "host", "bridge", "private", "pasta", "container", "ns", "default"} {
565565
nc := podmanTest.Podman([]string{"network", "create", name})
566566
nc.WaitWithDefaultTimeout()
567567
Expect(nc).To(ExitWithError(125, fmt.Sprintf("cannot create network with name %q because it conflicts with a valid network mode", name)))

test/e2e/pod_create_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -557,18 +557,6 @@ entrypoint ["/fromimage"]
557557
Expect(check2.OutputToString()).To(Equal("/fromcommand:[/fromcommand]"))
558558
})
559559

560-
It("podman create pod with slirp network option", func() {
561-
name := "test"
562-
session := podmanTest.Podman([]string{"pod", "create", "--name", name, "--network", "slirp4netns:port_handler=slirp4netns", "-p", "8082:8000"})
563-
session.WaitWithDefaultTimeout()
564-
Expect(session).Should(ExitCleanly())
565-
566-
check := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{.InfraConfig.NetworkOptions.slirp4netns}}", name})
567-
check.WaitWithDefaultTimeout()
568-
Expect(check).Should(ExitCleanly())
569-
Expect(check.OutputToString()).To(Equal("[port_handler=slirp4netns]"))
570-
})
571-
572560
It("podman pod status test", func() {
573561
podName := "testpod"
574562
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})

test/e2e/run_networking_test.go

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ package integration
55
import (
66
"encoding/json"
77
"fmt"
8-
"io"
98
"net"
109
"os"
11-
"strconv"
1210
"strings"
13-
"sync"
1411
"syscall"
1512

1613
"github.com/containernetworking/plugins/pkg/ns"
@@ -561,112 +558,6 @@ EXPOSE 2004-2005/tcp`, ALPINE)
561558
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", "0.0.0.0"))
562559
})
563560

564-
It("podman run slirp4netns verify net.ipv6.conf.default.accept_dad=0", func() {
565-
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:enable_ipv6=true", ALPINE, "ip", "addr"})
566-
session.WaitWithDefaultTimeout()
567-
Expect(session).Should(ExitCleanly())
568-
// check the ipv6 setup id done without delay (https://github.com/containers/podman/issues/11062)
569-
Expect(session.OutputToString()).To(ContainSubstring("inet6 fd00::"))
570-
571-
const ipv6ConfDefaultAcceptDadSysctl = "/proc/sys/net/ipv6/conf/all/accept_dad"
572-
573-
cat := SystemExec("cat", []string{ipv6ConfDefaultAcceptDadSysctl})
574-
cat.WaitWithDefaultTimeout()
575-
Expect(cat).Should(ExitCleanly())
576-
sysctlValue := cat.OutputToString()
577-
578-
session = podmanTest.Podman([]string{"run", "--network", "slirp4netns:enable_ipv6=true", ALPINE, "cat", ipv6ConfDefaultAcceptDadSysctl})
579-
session.WaitWithDefaultTimeout()
580-
Expect(session).Should(ExitCleanly())
581-
Expect(session.OutputToString()).To(Equal(sysctlValue))
582-
})
583-
584-
It("podman run network expose host port 8080 to container port 8000 using invalid port handler", func() {
585-
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:port_handler=invalid", "-dt", "-p", "8080:8000", ALPINE, "/bin/sh"})
586-
session.WaitWithDefaultTimeout()
587-
Expect(session).To(ExitWithError(126, `unknown port_handler for slirp4netns: "invalid"`))
588-
})
589-
590-
It("podman run slirp4netns network with host loopback", func() {
591-
session := podmanTest.Podman([]string{"run", "--cap-add", "net_raw", "--network", "slirp4netns:allow_host_loopback=true", ALPINE, "ping", "-c1", "10.0.2.2"})
592-
session.WaitWithDefaultTimeout()
593-
Expect(session).Should(ExitCleanly())
594-
})
595-
596-
It("podman run slirp4netns network with mtu", func() {
597-
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:mtu=9000", ALPINE, "ip", "addr"})
598-
session.Wait(30)
599-
Expect(session).Should(ExitCleanly())
600-
Expect(session.OutputToString()).To(ContainSubstring("mtu 9000"))
601-
})
602-
603-
It("podman run slirp4netns network with different cidr", func() {
604-
slirp4netnsHelp := SystemExec("slirp4netns", []string{"--help"})
605-
Expect(slirp4netnsHelp).Should(ExitCleanly())
606-
607-
networkConfiguration := "slirp4netns:cidr=192.168.0.0/24,allow_host_loopback=true"
608-
session := podmanTest.Podman([]string{"run", "--cap-add", "net_raw", "--network", networkConfiguration, ALPINE, "ping", "-c1", "192.168.0.2"})
609-
session.Wait(30)
610-
611-
if strings.Contains(slirp4netnsHelp.OutputToString(), "cidr") {
612-
Expect(session).Should(ExitCleanly())
613-
} else {
614-
Expect(session).To(ExitWithError(125, "cidr not supported"))
615-
}
616-
})
617-
618-
for _, local := range []bool{true, false} {
619-
testName := "HostIP"
620-
if local {
621-
testName = "127.0.0.1"
622-
}
623-
It(fmt.Sprintf("podman run network slirp4netns bind to %s", testName), func() {
624-
ip := "127.0.0.1"
625-
if !local {
626-
// Determine our likeliest outgoing IP address
627-
conn, err := net.Dial("udp", "8.8.8.8:80")
628-
Expect(err).ToNot(HaveOccurred())
629-
630-
defer conn.Close()
631-
ip = conn.LocalAddr().(*net.UDPAddr).IP.String()
632-
}
633-
port := strconv.Itoa(GetPort())
634-
635-
networkConfiguration := fmt.Sprintf("slirp4netns:outbound_addr=%s,allow_host_loopback=true", ip)
636-
637-
listener, err := net.Listen("tcp", ":"+port)
638-
Expect(err).ToNot(HaveOccurred())
639-
defer listener.Close()
640-
641-
msg := RandomString(10)
642-
wg := &sync.WaitGroup{}
643-
wg.Add(1)
644-
// now use a new goroutine to start accepting connection in the background and make the checks there
645-
go func() {
646-
defer GinkgoRecover()
647-
defer wg.Done()
648-
conn, err := listener.Accept()
649-
Expect(err).ToNot(HaveOccurred(), "accept new connection")
650-
defer conn.Close()
651-
addr := conn.RemoteAddr()
652-
// addr will be in the form ip:port, we don't care about the port as it is random
653-
Expect(addr.String()).To(HavePrefix(ip+":"), "remote address")
654-
gotBytes, err := io.ReadAll(conn)
655-
Expect(err).ToNot(HaveOccurred(), "read from connection")
656-
Expect(string(gotBytes)).To(Equal(msg), "received correct message from container")
657-
}()
658-
659-
session := podmanTest.Podman([]string{"run", "--network", networkConfiguration, ALPINE, "sh", "-c", "echo -n " + msg + " | nc -w 30 10.0.2.2 " + port})
660-
session.WaitWithDefaultTimeout()
661-
Expect(session).Should(ExitCleanly())
662-
663-
// explicitly close the socket here before we wait to unlock Accept() calls in case of hangs
664-
listener.Close()
665-
// wait for the checks in the goroutine to be done
666-
wg.Wait()
667-
})
668-
}
669-
670561
It("podman run network expose ports in image metadata", func() {
671562
session := podmanTest.Podman([]string{"create", "--name", "test", "-t", "-P", NGINX_IMAGE})
672563
session.WaitWithDefaultTimeout()

test/e2e/stats_test.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -149,29 +149,6 @@ var _ = Describe("Podman stats", func() {
149149
Expect(session).Should(ExitCleanly())
150150
})
151151

152-
It("podman stats on container with forced slirp4netns", func() {
153-
// This will force the slirp4netns net mode to be tested as root
154-
session := podmanTest.Podman([]string{"run", "-d", "--net", "slirp4netns", ALPINE, "top"})
155-
session.WaitWithDefaultTimeout()
156-
Expect(session).Should(ExitCleanly())
157-
session = podmanTest.Podman([]string{"stats", "--no-stream", "-a"})
158-
session.WaitWithDefaultTimeout()
159-
Expect(session).Should(ExitCleanly())
160-
})
161-
162-
It("podman reads slirp4netns network stats", func() {
163-
session := podmanTest.Podman([]string{"run", "-d", "--network", "slirp4netns", ALPINE, "top"})
164-
session.WaitWithDefaultTimeout()
165-
Expect(session).Should(ExitCleanly())
166-
167-
cid := session.OutputToString()
168-
169-
stats := podmanTest.Podman([]string{"stats", "--format", "'{{.NetIO}}'", "--no-stream", cid})
170-
stats.WaitWithDefaultTimeout()
171-
Expect(stats).Should(ExitCleanly())
172-
Expect(stats.OutputToString()).To(Not(ContainSubstring("-- / --")))
173-
})
174-
175152
// Regression test for #8265
176153
It("podman stats with custom memory limits", func() {
177154
// Run three containers. One with a memory limit. Make sure

0 commit comments

Comments
 (0)