summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/pod_create_test.go43
-rw-r--r--test/e2e/system_reset_test.go18
-rw-r--r--test/system/005-info.bats12
-rw-r--r--test/system/200-pod.bats2
-rw-r--r--test/system/500-networking.bats41
-rw-r--r--test/system/520-checkpoint.bats4
-rw-r--r--test/system/README.md1
-rw-r--r--test/system/helpers.bash9
8 files changed, 109 insertions, 21 deletions
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index c3f77857e..04e8cfd07 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -1066,4 +1066,47 @@ ENTRYPOINT ["sleep","99999"]
})
+ It("podman pod create --share-parent test", func() {
+ SkipIfRootlessCgroupsV1("rootless cannot use cgroups with cgroupsv1")
+ podCreate := podmanTest.Podman([]string{"pod", "create", "--share-parent=false"})
+ podCreate.WaitWithDefaultTimeout()
+ Expect(podCreate).Should(Exit(0))
+
+ ctrCreate := podmanTest.Podman([]string{"run", "-dt", "--pod", podCreate.OutputToString(), ALPINE})
+ ctrCreate.WaitWithDefaultTimeout()
+ Expect(ctrCreate).Should(Exit(0))
+
+ inspectPod := podmanTest.Podman([]string{"pod", "inspect", podCreate.OutputToString()})
+ inspectPod.WaitWithDefaultTimeout()
+ Expect(inspectPod).Should(Exit(0))
+ data := inspectPod.InspectPodToJSON()
+
+ inspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
+ Expect(data.CgroupPath).To(HaveLen(0))
+ if podmanTest.CgroupManager == "cgroupfs" || !rootless.IsRootless() {
+ Expect(inspect[0].HostConfig.CgroupParent).To(HaveLen(0))
+ } else if podmanTest.CgroupManager == "systemd" {
+ Expect(inspect[0].HostConfig.CgroupParent).To(Equal("user.slice"))
+ }
+
+ podCreate2 := podmanTest.Podman([]string{"pod", "create", "--share", "cgroup,ipc,net,uts", "--share-parent=false", "--infra-name", "cgroupCtr"})
+ podCreate2.WaitWithDefaultTimeout()
+ Expect(podCreate2).Should(Exit(0))
+
+ ctrCreate2 := podmanTest.Podman([]string{"run", "-dt", "--pod", podCreate2.OutputToString(), ALPINE})
+ ctrCreate2.WaitWithDefaultTimeout()
+ Expect(ctrCreate2).Should(Exit(0))
+
+ inspectInfra := podmanTest.InspectContainer("cgroupCtr")
+
+ inspect2 := podmanTest.InspectContainer(ctrCreate2.OutputToString())
+
+ Expect(inspect2[0].HostConfig.CgroupMode).To(ContainSubstring(inspectInfra[0].ID))
+
+ podCreate3 := podmanTest.Podman([]string{"pod", "create", "--share", "cgroup"})
+ podCreate3.WaitWithDefaultTimeout()
+ Expect(podCreate3).ShouldNot(Exit(0))
+
+ })
+
})
diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go
index 641f98c38..f413ce147 100644
--- a/test/e2e/system_reset_test.go
+++ b/test/e2e/system_reset_test.go
@@ -38,6 +38,10 @@ var _ = Describe("podman system reset", func() {
SkipIfRemote("system reset not supported on podman --remote")
// system reset will not remove additional store images, so need to grab length
+ // change the network dir so that we do not conflict with other tests
+ // that would use the same network dir and cause unnecessary flakes
+ podmanTest.NetworkConfigDir = tempdir
+
session := podmanTest.Podman([]string{"rmi", "--force", "--all"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -56,16 +60,16 @@ var _ = Describe("podman system reset", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+ session = podmanTest.Podman([]string{"network", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
session = podmanTest.Podman([]string{"system", "reset", "-f"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(Not(ContainSubstring("Failed to add pause process")))
- // If remote then the API service should have exited
- // On local tests this is a noop
- podmanTest.StartRemoteService()
-
session = podmanTest.Podman([]string{"images", "-n"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -80,5 +84,11 @@ var _ = Describe("podman system reset", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
+
+ session = podmanTest.Podman([]string{"network", "ls", "-q"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ // default network should exists
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
})
})
diff --git a/test/system/005-info.bats b/test/system/005-info.bats
index 5f3cdff7e..0f7e8b2e4 100644
--- a/test/system/005-info.bats
+++ b/test/system/005-info.bats
@@ -88,6 +88,18 @@ host.slirp4netns.executable | $expr_path
is "$output" ".*graphOptions: {}" "output includes graphOptions: {}"
}
+@test "podman info netavark " {
+ # Confirm netavark in use when explicitely required by execution environment.
+ if [[ "$NETWORK_BACKEND" == "netavark" ]]; then
+ if ! is_netavark; then
+ # Assume is_netavark() will provide debugging feedback.
+ die "Netavark driver testing required, but not in use by podman."
+ fi
+ else
+ skip "Netavark testing not requested (\$NETWORK_BACKEND='$NETWORK_BACKEND')"
+ fi
+}
+
@test "podman --root PATH info - basic output" {
if ! is_remote; then
run_podman --storage-driver=vfs --root ${PODMAN_TMPDIR}/nothing-here-move-along info --format '{{ .Store.GraphOptions }}'
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index bccd04e8d..34dfaa8f6 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -340,7 +340,7 @@ EOF
run_podman 125 pod create --share bogus --name $pod_name
is "$output" ".*Invalid kernel namespace to share: bogus. Options are: cgroup, ipc, net, pid, uts or none" \
"pod test for bogus --share option"
- run_podman pod create --share cgroup,ipc --name $pod_name
+ run_podman pod create --share ipc --name $pod_name
run_podman run --rm --pod $pod_name --hostname foobar $IMAGE hostname
is "$output" "foobar" "--hostname should work with non share UTS namespace"
}
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index e54b8d26a..4b1a22981 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -256,13 +256,17 @@ load helpers
# rootless cannot modify iptables
if ! is_rootless; then
- # flush the CNI iptables here
- run iptables -t nat -F CNI-HOSTPORT-DNAT
+ # flush the port forwarding iptable rule here
+ chain="CNI-HOSTPORT-DNAT"
+ if is_netavark; then
+ chain="NETAVARK-HOSTPORT-DNAT"
+ fi
+ run iptables -t nat -F "$chain"
# check that we cannot curl (timeout after 5 sec)
run timeout 5 curl -s $SERVER/index.txt
if [ "$status" -ne 124 ]; then
- die "curl did not timeout, status code: $status"
+ die "curl did not timeout, status code: $status"
fi
fi
@@ -597,7 +601,7 @@ load helpers
searchIP="100.100.100.100"
cat >$containersconf <<EOF
[containers]
- dns_searches = [ "example.com", "test1.com"]
+ dns_searches = [ "example.com"]
dns_servers = [
"1.1.1.1",
"$searchIP",
@@ -605,14 +609,27 @@ load helpers
"8.8.8.8",
]
EOF
-export searchDNS="search example.com
-search test1.com
-search a.b"
- CONTAINERS_CONF=$containersconf run_podman run --rm $IMAGE grep "example.com" /etc/resolv.conf
- CONTAINERS_CONF=$containersconf run_podman run --rm $IMAGE grep $searchIP /etc/resolv.conf
- is "$output" "nameserver $searchIP" "Should only be one $searchIP not multiple"
- CONTAINERS_CONF=$containersconf run_podman run --dns-search a.b --rm $IMAGE grep search /etc/resolv.conf
- is "$output" "$searchDNS" "Searches should be on different lines"
+
+ local nl="
+"
+
+ CONTAINERS_CONF=$containersconf run_podman run --rm $IMAGE cat /etc/resolv.conf
+ is "$output" "search example.com$nl.*" "correct seach domain"
+ is "$output" ".*nameserver 1.1.1.1${nl}nameserver $searchIP${nl}nameserver 1.0.0.1${nl}nameserver 8.8.8.8" "nameserver order is correct"
+
+ # create network with dns
+ local netname=testnet-$(random_string 10)
+ local subnet=$(random_rfc1918_subnet)
+ run_podman network create --subnet "$subnet.0/24" $netname
+ # custom server overwrites the network dns server
+ CONTAINERS_CONF=$containersconf run_podman run --network $netname --rm $IMAGE cat /etc/resolv.conf
+ is "$output" "search example.com$nl.*" "correct seach domain"
+ is "$output" ".*nameserver 1.1.1.1${nl}nameserver $searchIP${nl}nameserver 1.0.0.1${nl}nameserver 8.8.8.8" "nameserver order is correct"
+
+ # we should use the integrated dns server
+ run_podman run --network $netname --rm $IMAGE cat /etc/resolv.conf
+ is "$output" "search dns.podman.*" "correct seach domain"
+ is "$output" ".*nameserver $subnet.1.*" "integrated dns nameserver is set"
}
# vim: filetype=sh
diff --git a/test/system/520-checkpoint.bats b/test/system/520-checkpoint.bats
index fcb7fbb84..046dfd126 100644
--- a/test/system/520-checkpoint.bats
+++ b/test/system/520-checkpoint.bats
@@ -15,10 +15,6 @@ function setup() {
skip "FIXME: checkpointing broken in Ubuntu 2004, 2104, 2110, ..."
fi
- if [[ "$(uname -r)" =~ "5.17" ]]; then
- skip "FIXME: checkpointing broken on kernel 5.17 (#12949)"
- fi
-
# None of these tests work rootless....
if is_rootless; then
# ...however, is that a genuine cast-in-stone limitation, or one
diff --git a/test/system/README.md b/test/system/README.md
index fe6d1ed52..76626b6dd 100644
--- a/test/system/README.md
+++ b/test/system/README.md
@@ -49,6 +49,7 @@ Running tests
To run the tests locally in your sandbox, you can use one of these methods:
* make;PODMAN=./bin/podman bats ./test/system/070-build.bats # runs just the specified test
* make;PODMAN=./bin/podman bats ./test/system # runs all
+* make;PODMAN=./bin/podman NETWORK_BACKEND=netavark bats ./test/system # Assert & enable netavark testing
To test as root:
* $ PODMAN=./bin/podman sudo --preserve-env=PODMAN bats test/system
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 36a88fc10..c622a5172 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -341,6 +341,15 @@ function is_cgroupsv2() {
test "$cgroup_type" = "cgroup2fs"
}
+# True if podman is using netavark
+function is_netavark() {
+ run_podman info --format '{{.Host.NetworkBackend}}'
+ if [[ "$output" =~ netavark ]]; then
+ return 0
+ fi
+ return 1
+}
+
# Returns the OCI runtime *basename* (typically crun or runc). Much as we'd
# love to cache this result, we probably shouldn't.
function podman_runtime() {