summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/network_test.go29
-rw-r--r--test/e2e/pod_create_test.go20
-rw-r--r--test/e2e/run_networking_test.go7
-rw-r--r--test/python/docker/test_containers.py9
-rw-r--r--test/system/030-run.bats39
-rw-r--r--test/system/140-diff.bats7
-rw-r--r--test/system/160-volumes.bats15
7 files changed, 118 insertions, 8 deletions
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index 124ee7e29..c6010ba43 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -487,7 +487,6 @@ var _ = Describe("Podman network", func() {
inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout()
Expect(inspect.ExitCode()).To(BeZero())
- fmt.Println(inspect.OutputToString())
out, err := inspect.jq(".[0].plugins[0].master")
Expect(err).To(BeNil())
@@ -513,4 +512,32 @@ var _ = Describe("Podman network", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(1))
})
+
+ It("podman network create macvlan with network info and options", func() {
+ net := "macvlan" + stringid.GenerateNonCryptoID()
+ nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", "-o", "mtu=1500", "--gateway", "192.168.1.254", "--subnet", "192.168.1.0/24", net})
+ nc.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net)
+ Expect(nc.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"network", "inspect", net})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(BeZero())
+
+ mtu, err := inspect.jq(".[0].plugins[0].mtu")
+ Expect(err).To(BeNil())
+ Expect(mtu).To(Equal("1500"))
+
+ gw, err := inspect.jq(".[0].plugins[0].ipam.ranges[0][0].gateway")
+ Expect(err).To(BeNil())
+ Expect(gw).To(Equal("\"192.168.1.254\""))
+
+ subnet, err := inspect.jq(".[0].plugins[0].ipam.ranges[0][0].subnet")
+ Expect(err).To(BeNil())
+ Expect(subnet).To(Equal("\"192.168.1.0/24\""))
+
+ nc = podmanTest.Podman([]string{"network", "rm", net})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc.ExitCode()).To(Equal(0))
+ })
})
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index fc634d36f..e57712f62 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -478,12 +478,7 @@ entrypoint ["/fromimage"]
})
It("podman create with unsupported network options", func() {
- podCreate := podmanTest.Podman([]string{"pod", "create", "--network", "none"})
- podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
- Expect(podCreate.ErrorToString()).To(ContainSubstring("pods presently do not support network mode none"))
-
- podCreate = podmanTest.Podman([]string{"pod", "create", "--network", "container:doesnotmatter"})
+ podCreate := podmanTest.Podman([]string{"pod", "create", "--network", "container:doesnotmatter"})
podCreate.WaitWithDefaultTimeout()
Expect(podCreate.ExitCode()).To(Equal(125))
Expect(podCreate.ErrorToString()).To(ContainSubstring("pods presently do not support network mode container"))
@@ -493,4 +488,17 @@ entrypoint ["/fromimage"]
Expect(podCreate.ExitCode()).To(Equal(125))
Expect(podCreate.ErrorToString()).To(ContainSubstring("pods presently do not support network mode path"))
})
+
+ It("podman pod create with --net=none", func() {
+ podName := "testPod"
+ podCreate := podmanTest.Podman([]string{"pod", "create", "--network", "none", "--name", podName})
+ podCreate.WaitWithDefaultTimeout()
+ Expect(podCreate.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "ip", "-o", "-4", "addr"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("inet 127.0.0.1/8 scope host lo"))
+ Expect(len(session.OutputToStringArray())).To(Equal(1))
+ })
})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index ebea2132a..676f24e5d 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -376,6 +376,13 @@ var _ = Describe("Podman run networking", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman run slirp4netns network with mtu", func() {
+ session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:mtu=9000", ALPINE, "ip", "addr"})
+ session.Wait(30)
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("mtu 9000"))
+ })
+
It("podman run slirp4netns network with different cidr", func() {
slirp4netnsHelp := SystemExec("slirp4netns", []string{"--help"})
Expect(slirp4netnsHelp.ExitCode()).To(Equal(0))
diff --git a/test/python/docker/test_containers.py b/test/python/docker/test_containers.py
index 01e049ed4..5c2a5fef2 100644
--- a/test/python/docker/test_containers.py
+++ b/test/python/docker/test_containers.py
@@ -95,6 +95,15 @@ class TestContainers(unittest.TestCase):
top.reload()
self.assertIn(top.status, ("stopped", "exited"))
+ def test_kill_container(self):
+ top = self.client.containers.get(TestContainers.topContainerId)
+ self.assertEqual(top.status, "running")
+
+ # Kill a running container and validate the state
+ top.kill()
+ top.reload()
+ self.assertIn(top.status, ("stopped", "exited"))
+
def test_restart_container(self):
# Validate the container state
top = self.client.containers.get(TestContainers.topContainerId)
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index dcf1da370..6c3812dce 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -610,4 +610,43 @@ json-file | f
is "$output" "$randomcontent" "cat random content"
}
+# https://github.com/containers/podman/issues/9096
+# podman exec may truncate stdout/stderr; actually a bug in conmon:
+# https://github.com/containers/conmon/issues/236
+@test "podman run - does not truncate or hang with big output" {
+ # Size, in bytes, to dd and to expect in return
+ char_count=700000
+
+ # Container name; primarily needed when running podman-remote
+ cname=mybigdatacontainer
+
+ # This is one of those cases where BATS is not the best test framework.
+ # We can't do any output redirection, because 'run' overrides it so
+ # as to preserve $output. We can't _not_ do redirection, because BATS
+ # doesn't like NULs in $output (and neither would humans who might
+ # have to read them in an error log).
+ # Workaround: write to a log file, and don't attach stdout.
+ run_podman run --name $cname --attach stderr --log-driver k8s-file \
+ $IMAGE dd if=/dev/zero count=$char_count bs=1
+ is "${lines[0]}" "$char_count+0 records in" "dd: number of records in"
+ is "${lines[1]}" "$char_count+0 records out" "dd: number of records out"
+
+ # We don't have many tests for '-l'. This is as good a place as any
+ if ! is_remote; then
+ cname=-l
+ fi
+
+ # Now find that log file, and count the NULs in it.
+ # The log file is of the form '<timestamp> <P|F> <data>', where P|F
+ # is Partial/Full; I think that's called "kubernetes log format"?
+ run_podman inspect $cname --format '{{.HostConfig.LogConfig.Path}}'
+ logfile="$output"
+
+ count_zero=$(tr -cd '\0' <$logfile | wc -c)
+ is "$count_zero" "$char_count" "count of NULL characters in log"
+
+ # Clean up
+ run_podman rm $cname
+}
+
# vim: filetype=sh
diff --git a/test/system/140-diff.bats b/test/system/140-diff.bats
index 1277f9bbe..02b3a86ca 100644
--- a/test/system/140-diff.bats
+++ b/test/system/140-diff.bats
@@ -25,7 +25,12 @@ load helpers
)
for field in ${!expect[@]}; do
- result=$(jq -r -c ".${field}[]" <<<"$output")
+ # ARGH! The /sys/fs kludgery is for RHEL8 rootless, which mumble mumble
+ # does some sort of magic muckery with /sys - I think the relevant
+ # PR is https://github.com/containers/podman/pull/8561
+ # Anyhow, without the egrep below, this test fails about 50% of the
+ # time on rootless RHEL8. (No, I don't know why it's not 100%).
+ result=$(jq -r -c ".${field}[]" <<<"$output" | egrep -v '^/sys/fs')
is "$result" "${expect[$field]}" "$field"
done
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index 0b7aab2fb..4952eafc2 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -214,6 +214,13 @@ EOF
run_podman volume create $vol
done
+ # Create two additional labeled volumes
+ for i in 5 6; do
+ vol=myvol${i}$(random_string)
+ v[$i]=$vol
+ run_podman volume create $vol --label "mylabel"
+ done
+
# (Assert that output is formatted, not a one-line blob: #8011)
run_podman volume inspect ${v[1]}
if [[ "${#lines[*]}" -lt 10 ]]; then
@@ -225,6 +232,14 @@ EOF
run_podman run --name c2 --volume ${v[2]}:/vol2 -v ${v[3]}:/vol3 \
$IMAGE date
+ # List available volumes for pruning after using 1,2,3
+ run_podman volume prune <<< N
+ is "$(echo $(sort <<<${lines[@]:1:3}))" "${v[4]} ${v[5]} ${v[6]}" "volume prune, with 1,2,3 in use, lists 4,5,6"
+
+ # List available volumes for pruning after using 1,2,3 and filtering; see #8913
+ run_podman volume prune --filter label=mylabel <<< N
+ is "$(echo $(sort <<<${lines[@]:1:2}))" "${v[5]} ${v[6]}" "volume prune, with 1,2,3 in use and 4 filtered out, lists 5,6"
+
# prune should remove v4
run_podman volume prune --force
is "$output" "${v[4]}" "volume prune, with 1, 2, 3 in use, deletes only 4"