summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/20-containers.at25
-rw-r--r--test/apiv2/rest_api/test_rest_v2_0_0.py246
-rw-r--r--test/e2e/attach_test.go10
-rw-r--r--test/e2e/build_test.go8
-rw-r--r--test/e2e/checkpoint_test.go2
-rw-r--r--test/e2e/commit_test.go2
-rw-r--r--test/e2e/common_test.go1
-rw-r--r--test/e2e/config.go4
-rw-r--r--test/e2e/containers_conf_test.go11
-rw-r--r--test/e2e/cp_test.go2
-rw-r--r--test/e2e/create_staticip_test.go6
-rw-r--r--test/e2e/create_test.go16
-rw-r--r--test/e2e/events_test.go8
-rw-r--r--test/e2e/exec_test.go43
-rw-r--r--test/e2e/generate_kube_test.go34
-rw-r--r--test/e2e/healthcheck_run_test.go1
-rw-r--r--test/e2e/images_test.go40
-rw-r--r--test/e2e/info_test.go2
-rw-r--r--test/e2e/init_test.go2
-rw-r--r--test/e2e/inspect_test.go4
-rw-r--r--test/e2e/kill_test.go9
-rw-r--r--test/e2e/libpod_suite_remote_test.go11
-rw-r--r--test/e2e/libpod_suite_test.go12
-rw-r--r--test/e2e/libpod_suite_varlink_test.go11
-rw-r--r--test/e2e/load_test.go20
-rw-r--r--test/e2e/logs_test.go2
-rw-r--r--test/e2e/manifest_test.go5
-rw-r--r--test/e2e/mount_test.go29
-rw-r--r--test/e2e/namespace_test.go2
-rw-r--r--test/e2e/network_create_test.go6
-rw-r--r--test/e2e/network_test.go51
-rw-r--r--test/e2e/pause_test.go2
-rw-r--r--test/e2e/play_kube_test.go90
-rw-r--r--test/e2e/pod_create_test.go37
-rw-r--r--test/e2e/pod_infra_container_test.go7
-rw-r--r--test/e2e/pod_kill_test.go7
-rw-r--r--test/e2e/pod_pause_test.go2
-rw-r--r--test/e2e/pod_pod_namespaces.go2
-rw-r--r--test/e2e/pod_ps_test.go10
-rw-r--r--test/e2e/pod_restart_test.go7
-rw-r--r--test/e2e/pod_rm_test.go9
-rw-r--r--test/e2e/pod_start_test.go7
-rw-r--r--test/e2e/pod_stats_test.go2
-rw-r--r--test/e2e/pod_stop_test.go7
-rw-r--r--test/e2e/pod_top_test.go6
-rw-r--r--test/e2e/port_test.go20
-rw-r--r--test/e2e/prune_test.go6
-rw-r--r--test/e2e/ps_test.go7
-rw-r--r--test/e2e/pull_test.go8
-rw-r--r--test/e2e/push_test.go2
-rw-r--r--test/e2e/restart_test.go7
-rw-r--r--test/e2e/rm_test.go11
-rw-r--r--test/e2e/rmi_test.go4
-rw-r--r--test/e2e/run_apparmor_test.go2
-rw-r--r--test/e2e/run_cgroup_parent_test.go3
-rw-r--r--test/e2e/run_cleanup_test.go4
-rw-r--r--test/e2e/run_cpu_test.go44
-rw-r--r--test/e2e/run_device_test.go2
-rw-r--r--test/e2e/run_dns_test.go1
-rw-r--r--test/e2e/run_entrypoint_test.go7
-rw-r--r--test/e2e/run_env_test.go4
-rw-r--r--test/e2e/run_memory_test.go2
-rw-r--r--test/e2e/run_networking_test.go17
-rw-r--r--test/e2e/run_passwd_test.go2
-rw-r--r--test/e2e/run_privileged_test.go10
-rw-r--r--test/e2e/run_restart_test.go2
-rw-r--r--test/e2e/run_security_labels.go2
-rw-r--r--test/e2e/run_selinux_test.go2
-rw-r--r--test/e2e/run_staticip_test.go2
-rw-r--r--test/e2e/run_test.go237
-rw-r--r--test/e2e/run_volume_test.go11
-rw-r--r--test/e2e/run_working_dir.go2
-rw-r--r--test/e2e/runlabel_test.go3
-rw-r--r--test/e2e/search_test.go9
-rw-r--r--test/e2e/start_test.go7
-rw-r--r--test/e2e/stats_test.go2
-rw-r--r--test/e2e/stop_test.go13
-rw-r--r--test/e2e/system_df_test.go2
-rw-r--r--test/e2e/system_reset_test.go2
-rw-r--r--test/e2e/systemd_test.go2
-rw-r--r--test/e2e/unshare_test.go2
-rw-r--r--test/e2e/untag_test.go2
-rw-r--r--test/e2e/version_test.go6
-rw-r--r--test/system/005-info.bats4
-rw-r--r--test/system/010-images.bats47
-rw-r--r--test/system/030-run.bats78
-rw-r--r--test/system/060-mount.bats30
-rw-r--r--test/system/070-build.bats8
-rw-r--r--test/system/080-pause.bats4
-rw-r--r--test/system/120-load.bats41
-rw-r--r--test/system/160-volumes.bats1
-rw-r--r--test/system/200-pod.bats31
-rw-r--r--test/system/500-networking.bats29
-rwxr-xr-xtest/system/build-testimage44
-rw-r--r--test/system/helpers.bash48
-rwxr-xr-xtest/system/helpers.t9
96 files changed, 1283 insertions, 382 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 9ea3cb7ed..187073fb9 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -176,6 +176,31 @@ t GET containers/$cid/json 200 \
.Config.Cmd='[]' \
.Path="echo" \
.Args[0]="param1"
+
+# create a running container for after
+t POST containers/create '"Image":"'$IMAGE'","Entrypoint":["top"]' 201 \
+ .Id~[0-9a-f]\\{64\\}
+cid_top=$(jq -r '.Id' <<<"$output")
+t GET containers/${cid_top}/json 200 \
+ .Config.Entrypoint[0]="top" \
+ .Config.Cmd='[]' \
+ .Path="top"
+t POST containers/${cid_top}/start '' 204
+# make sure the container is running
+t GET containers/${cid_top}/json 200 \
+ .State.Status="running"
+
+# 0 means unlimited, need same with docker
+t GET containers/json?limit=0 200 \
+ .[0].Id~[0-9a-f]\\{64\\}
+
+t GET 'containers/json?limit=0&all=1' 200 \
+ .[0].Id~[0-9a-f]\\{64\\} \
+ .[1].Id~[0-9a-f]\\{64\\}
+
+t POST containers/${cid_top}/stop "" 204
+
t DELETE containers/$cid 204
+t DELETE containers/$cid_top 204
# vim: filetype=sh
diff --git a/test/apiv2/rest_api/test_rest_v2_0_0.py b/test/apiv2/rest_api/test_rest_v2_0_0.py
new file mode 100644
index 000000000..3376f8402
--- /dev/null
+++ b/test/apiv2/rest_api/test_rest_v2_0_0.py
@@ -0,0 +1,246 @@
+import json
+import os
+import subprocess
+import sys
+import time
+import unittest
+from multiprocessing import Process
+
+import requests
+from dateutil.parser import parse
+
+PODMAN_URL = "http://localhost:8080"
+
+
+def _url(path):
+ return PODMAN_URL + "/v1.0.0/libpod" + path
+
+
+def podman():
+ binary = os.getenv("PODMAN_BINARY")
+ if binary is None:
+ binary = "bin/podman"
+ return binary
+
+
+def ctnr(path):
+ r = requests.get(_url("/containers/json?all=true"))
+ try:
+ ctnrs = json.loads(r.text)
+ except Exception as e:
+ sys.stderr.write("Bad container response: {}/{}".format(r.text, e))
+ raise e
+ return path.format(ctnrs[0]["Id"])
+
+
+def validateObjectFields(buffer):
+ objs = json.loads(buffer)
+ if not isinstance(objs, dict):
+ for o in objs:
+ _ = o["Id"]
+ else:
+ _ = objs["Id"]
+ return objs
+
+
+class TestApi(unittest.TestCase):
+ podman = None
+
+ def setUp(self):
+ super().setUp()
+ if TestApi.podman.poll() is not None:
+ sys.stderr.write(f"podman service returned {TestApi.podman.returncode}\n")
+ sys.exit(2)
+ requests.get(
+ _url("/images/create?fromSrc=docker.io%2Falpine%3Alatest"))
+ # calling out to podman is easier than the API for running a container
+ subprocess.run([podman(), "run", "alpine", "/bin/ls"],
+ check=True,
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL)
+
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+
+ TestApi.podman = subprocess.Popen(
+ [
+ podman(), "system", "service", "tcp:localhost:8080",
+ "--log-level=debug", "--time=0"
+ ],
+ shell=False,
+ stdin=subprocess.DEVNULL,
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ )
+ time.sleep(2)
+
+ @classmethod
+ def tearDownClass(cls):
+ TestApi.podman.terminate()
+ stdout, stderr = TestApi.podman.communicate(timeout=0.5)
+ if stdout:
+ print("\nService Stdout:\n" + stdout.decode('utf-8'))
+ if stderr:
+ print("\nService Stderr:\n" + stderr.decode('utf-8'))
+
+ if TestApi.podman.returncode > 0:
+ sys.stderr.write(f"podman exited with error code {TestApi.podman.returncode}\n")
+ sys.exit(2)
+
+ return super().tearDownClass()
+
+ def test_info(self):
+ r = requests.get(_url("/info"))
+ self.assertEqual(r.status_code, 200)
+ self.assertIsNotNone(r.content)
+ _ = json.loads(r.text)
+
+ def test_events(self):
+ r = requests.get(_url("/events?stream=false"))
+ self.assertEqual(r.status_code, 200, r.text)
+ self.assertIsNotNone(r.content)
+ for line in r.text.splitlines():
+ obj = json.loads(line)
+ # Actor.ID is uppercase for compatibility
+ _ = obj["Actor"]["ID"]
+
+ def test_containers(self):
+ r = requests.get(_url("/containers/json"), timeout=5)
+ self.assertEqual(r.status_code, 200, r.text)
+ obj = json.loads(r.text)
+ self.assertEqual(len(obj), 0)
+
+ def test_containers_all(self):
+ r = requests.get(_url("/containers/json?all=true"))
+ self.assertEqual(r.status_code, 200, r.text)
+ validateObjectFields(r.text)
+
+ def test_inspect_container(self):
+ r = requests.get(_url(ctnr("/containers/{}/json")))
+ self.assertEqual(r.status_code, 200, r.text)
+ obj = validateObjectFields(r.content)
+ _ = parse(obj["Created"])
+
+ def test_stats(self):
+ r = requests.get(_url(ctnr("/containers/{}/stats?stream=false")))
+ self.assertIn(r.status_code, (200, 409), r.text)
+ if r.status_code == 200:
+ validateObjectFields(r.text)
+
+ def test_delete_containers(self):
+ r = requests.delete(_url(ctnr("/containers/{}")))
+ self.assertEqual(r.status_code, 204, r.text)
+
+ def test_stop_containers(self):
+ r = requests.post(_url(ctnr("/containers/{}/start")))
+ self.assertIn(r.status_code, (204, 304), r.text)
+
+ r = requests.post(_url(ctnr("/containers/{}/stop")))
+ self.assertIn(r.status_code, (204, 304), r.text)
+
+ def test_start_containers(self):
+ r = requests.post(_url(ctnr("/containers/{}/stop")))
+ self.assertIn(r.status_code, (204, 304), r.text)
+
+ r = requests.post(_url(ctnr("/containers/{}/start")))
+ self.assertIn(r.status_code, (204, 304), r.text)
+
+ def test_restart_containers(self):
+ r = requests.post(_url(ctnr("/containers/{}/start")))
+ self.assertIn(r.status_code, (204, 304), r.text)
+
+ r = requests.post(_url(ctnr("/containers/{}/restart")), timeout=5)
+ self.assertEqual(r.status_code, 204, r.text)
+
+ def test_resize(self):
+ r = requests.post(_url(ctnr("/containers/{}/resize?h=43&w=80")))
+ self.assertIn(r.status_code, (200, 409), r.text)
+ if r.status_code == 200:
+ self.assertIsNone(r.text)
+
+ def test_attach_containers(self):
+ r = requests.post(_url(ctnr("/containers/{}/attach")), timeout=5)
+ self.assertIn(r.status_code, (101, 500), r.text)
+
+ def test_logs_containers(self):
+ r = requests.get(_url(ctnr("/containers/{}/logs?stdout=true")))
+ self.assertEqual(r.status_code, 200, r.text)
+
+ def test_post_create(self):
+ self.skipTest("TODO: create request body")
+ r = requests.post(_url("/containers/create?args=True"))
+ self.assertEqual(r.status_code, 200, r.text)
+ json.loads(r.text)
+
+ def test_commit(self):
+ r = requests.post(_url(ctnr("/commit?container={}")))
+ self.assertEqual(r.status_code, 200, r.text)
+ validateObjectFields(r.text)
+
+ def test_images(self):
+ r = requests.get(_url("/images/json"))
+ self.assertEqual(r.status_code, 200, r.text)
+ validateObjectFields(r.content)
+
+ def test_inspect_image(self):
+ r = requests.get(_url("/images/alpine/json"))
+ self.assertEqual(r.status_code, 200, r.text)
+ obj = validateObjectFields(r.content)
+ _ = parse(obj["Created"])
+
+ def test_delete_image(self):
+ r = requests.delete(_url("/images/alpine?force=true"))
+ self.assertEqual(r.status_code, 200, r.text)
+ json.loads(r.text)
+
+ def test_pull(self):
+ r = requests.post(_url("/images/pull?reference=alpine"), timeout=15)
+ self.assertEqual(r.status_code, 200, r.status_code)
+ text = r.text
+ keys = {
+ "error": False,
+ "id": False,
+ "images": False,
+ "stream": False,
+ }
+ # Read and record stanza's from pull
+ for line in str.splitlines(text):
+ obj = json.loads(line)
+ key_list = list(obj.keys())
+ for k in key_list:
+ keys[k] = True
+
+ self.assertFalse(keys["error"], "Expected no errors")
+ self.assertTrue(keys["id"], "Expected to find id stanza")
+ self.assertTrue(keys["images"], "Expected to find images stanza")
+ self.assertTrue(keys["stream"], "Expected to find stream progress stanza's")
+
+ def test_search(self):
+ # Had issues with this test hanging when repositories not happy
+ def do_search():
+ r = requests.get(_url("/images/search?term=alpine"), timeout=5)
+ self.assertEqual(r.status_code, 200, r.text)
+ json.loads(r.text)
+
+ search = Process(target=do_search)
+ search.start()
+ search.join(timeout=10)
+ self.assertFalse(search.is_alive(), "/images/search took too long")
+
+ def test_ping(self):
+ r = requests.get(PODMAN_URL + "/_ping")
+ self.assertEqual(r.status_code, 200, r.text)
+
+ r = requests.head(PODMAN_URL + "/_ping")
+ self.assertEqual(r.status_code, 200, r.text)
+
+ r = requests.get(_url("/_ping"))
+ self.assertEqual(r.status_code, 200, r.text)
+
+ r = requests.get(_url("/_ping"))
+ self.assertEqual(r.status_code, 200, r.text)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go
index 7b18f71ac..8065f6298 100644
--- a/test/e2e/attach_test.go
+++ b/test/e2e/attach_test.go
@@ -40,7 +40,6 @@ var _ = Describe("Podman attach", func() {
})
It("podman attach to non-running container", func() {
- SkipIfRemote()
session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", "-i", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -51,8 +50,8 @@ var _ = Describe("Podman attach", func() {
})
It("podman container attach to non-running container", func() {
- SkipIfRemote()
session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-d", "-i", ALPINE, "ls"})
+
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -87,7 +86,6 @@ var _ = Describe("Podman attach", func() {
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
It("podman attach to the latest container", func() {
- SkipIfRemote()
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", ALPINE, "/bin/sh", "-c", "while true; do echo test1; sleep 1; done"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -96,7 +94,11 @@ var _ = Describe("Podman attach", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- results := podmanTest.Podman([]string{"attach", "-l"})
+ cid := "-l"
+ if IsRemote() {
+ cid = "test2"
+ }
+ results := podmanTest.Podman([]string{"attach", cid})
time.Sleep(2 * time.Second)
results.Signal(syscall.SIGTSTP)
Expect(results.OutputToString()).To(ContainSubstring("test2"))
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 0b6e919d0..e3e1044aa 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -38,7 +38,6 @@ var _ = Describe("Podman build", func() {
// Let's first do the most simple build possible to make sure stuff is
// happy and then clean up after ourselves to make sure that works too.
It("podman build and remove basic alpine", func() {
- SkipIfRemote()
session := podmanTest.PodmanNoCache([]string{"build", "build/basicalpine"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -58,7 +57,6 @@ var _ = Describe("Podman build", func() {
})
It("podman build with logfile", func() {
- SkipIfRemote()
logfile := filepath.Join(podmanTest.TempDir, "logfile")
session := podmanTest.PodmanNoCache([]string{"build", "--tag", "test", "--logfile", logfile, "build/basicalpine"})
session.WaitWithDefaultTimeout()
@@ -91,7 +89,7 @@ var _ = Describe("Podman build", func() {
// Check that builds with different values for the squash options
// create the appropriate number of layers, then clean up after.
It("podman build basic alpine with squash", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME: This is broken should be fixed")
session := podmanTest.PodmanNoCache([]string{"build", "-f", "build/squash/Dockerfile.squash-a", "-t", "test-squash-a:latest", "build/squash"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -179,8 +177,6 @@ var _ = Describe("Podman build", func() {
})
It("podman build basic alpine and print id to external file", func() {
- SkipIfRemote()
-
// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
Expect(err).To(BeNil())
@@ -225,7 +221,7 @@ var _ = Describe("Podman build", func() {
})
It("podman build --http_proxy flag", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME: This is broken should be fixed")
os.Setenv("http_proxy", "1.2.3.4")
podmanTest.RestoreAllArtifacts()
dockerfile := `FROM docker.io/library/alpine:latest
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 73ef8520b..93186bc8b 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -27,7 +27,7 @@ var _ = Describe("Podman checkpoint", func() {
)
BeforeEach(func() {
- SkipIfRootless()
+ SkipIfRootless() //checkpoint not supported in rootless mode
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index c1a213c00..3c7bbca66 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -210,7 +210,7 @@ var _ = Describe("Podman commit", func() {
It("podman commit with volume mounts and --include-volumes", func() {
// We need to figure out how volumes are going to work correctly with the remote
// client. This does not currently work.
- SkipIfRemote()
+ SkipIfRemote("--testing Remote Volumes")
s := podmanTest.Podman([]string{"run", "--name", "test1", "-v", "/tmp:/foo", "alpine", "date"})
s.WaitWithDefaultTimeout()
Expect(s.ExitCode()).To(Equal(0))
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 2ce3f9760..1943020c3 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -39,6 +39,7 @@ var (
ARTIFACT_DIR = "/tmp/.artifacts"
RESTORE_IMAGES = []string{ALPINE, BB, nginx}
defaultWaitTimeout = 90
+ CGROUPSV2, _ = cgroups.IsCgroup2UnifiedMode()
)
// PodmanTestIntegration struct for command line options
diff --git a/test/e2e/config.go b/test/e2e/config.go
index 71c4dee31..0e1850614 100644
--- a/test/e2e/config.go
+++ b/test/e2e/config.go
@@ -27,8 +27,4 @@ var (
// v2fail is a temporary variable to help us track
// tests that fail in v2
v2fail = "does not pass integration tests with v2 podman"
-
- // v2remotefail is a temporary variable to help us track
- // tests that fail in v2 remote
- v2remotefail = "does not pass integration tests with v2 podman remote"
)
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 8339b7732..ddb62c327 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -41,7 +41,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run limits test", func() {
- SkipIfRootless()
+ SkipIfRootlessCgroupsV1()
//containers.conf is set to "nofile=500:500"
session := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "ulimit", "-n"})
session.WaitWithDefaultTimeout()
@@ -80,7 +80,6 @@ var _ = Describe("Podman run", func() {
})
It("podman Capabilities in containers.conf", func() {
- SkipIfRootless()
os.Setenv("CONTAINERS_CONF", "config/containers.conf")
cap := podmanTest.Podman([]string{"run", ALPINE, "grep", "CapEff", "/proc/self/status"})
cap.WaitWithDefaultTimeout()
@@ -94,7 +93,6 @@ var _ = Describe("Podman run", func() {
})
It("podman Regular capabilities", func() {
- SkipIfRootless()
os.Setenv("CONTAINERS_CONF", "config/containers.conf")
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
@@ -176,12 +174,17 @@ var _ = Describe("Podman run", func() {
})
It("podman run containers.conf sysctl test", func() {
- SkipIfRootless()
//containers.conf is set to "net.ipv4.ping_group_range=0 1000"
session := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "cat", "/proc/sys/net/ipv4/ping_group_range"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring("1000"))
+
+ // Ignore containers.conf setting if --net=host
+ session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", fedoraMinimal, "cat", "/proc/sys/net/ipv4/ping_group_range"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).ToNot((ContainSubstring("1000")))
})
It("podman run containers.conf search domain", func() {
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index df43c1b87..a53485fa4 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -141,7 +141,7 @@ var _ = Describe("Podman cp", func() {
})
It("podman cp stdin/stdout", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME: podman-remote cp not implemented yet")
session := podmanTest.Podman([]string{"create", ALPINE, "ls", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go
index 606c1b10d..57d1c3f2c 100644
--- a/test/e2e/create_staticip_test.go
+++ b/test/e2e/create_staticip_test.go
@@ -37,21 +37,19 @@ var _ = Describe("Podman create with --ip flag", func() {
})
It("Podman create --ip with garbage address", func() {
- SkipIfRootless()
result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", "114232346", ALPINE, "ls"})
result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError())
})
It("Podman create --ip with v6 address", func() {
- SkipIfRootless()
result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", "2001:db8:bad:beef::1", ALPINE, "ls"})
result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError())
})
It("Podman create --ip with non-allocatable IP", func() {
- SkipIfRootless()
+ SkipIfRootless() // --ip is not supported in rootless mode
result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", "203.0.113.124", ALPINE, "ls"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
@@ -83,7 +81,7 @@ var _ = Describe("Podman create with --ip flag", func() {
})
It("Podman create two containers with the same IP", func() {
- SkipIfRootless()
+ SkipIfRootless() // --ip not supported in rootless mode
ip := GetRandomIPAddress()
result := podmanTest.Podman([]string{"create", "--name", "test1", "--ip", ip, ALPINE, "sleep", "999"})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 6022be5f6..45dbe9b56 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -108,13 +108,12 @@ var _ = Describe("Podman create", func() {
})
It("podman create --entrypoint \"\"", func() {
- Skip(v2remotefail)
session := podmanTest.Podman([]string{"create", "--entrypoint", "", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
- result := podmanTest.Podman([]string{"inspect", "-l", "--format", "{{.Config.Entrypoint}}"})
+ result := podmanTest.Podman([]string{"inspect", session.OutputToString(), "--format", "{{.Config.Entrypoint}}"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(result.OutputToString()).To(Equal(""))
@@ -134,7 +133,6 @@ var _ = Describe("Podman create", func() {
})
It("podman create --mount flag with multiple mounts", func() {
- Skip(v2remotefail)
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
err := os.MkdirAll(vol1, 0755)
Expect(err).To(BeNil())
@@ -160,7 +158,6 @@ var _ = Describe("Podman create", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("skip failing test on ppc64le")
}
- Skip(v2remotefail)
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
os.Mkdir(mountPath, 0755)
session := podmanTest.Podman([]string{"create", "--name", "test", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
@@ -346,7 +343,7 @@ var _ = Describe("Podman create", func() {
})
It("podman create --signature-policy", func() {
- SkipIfRemote() // SigPolicy not handled by remote
+ SkipIfRemote("SigPolicy not handled by remote")
session := podmanTest.Podman([]string{"create", "--pull=always", "--signature-policy", "/no/such/file", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
@@ -555,7 +552,7 @@ var _ = Describe("Podman create", func() {
})
It("create container in pod with IP should fail", func() {
- SkipIfRootless()
+ SkipIfRootless() //Setting IP not supported in rootless mode
name := "createwithstaticip"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
@@ -567,7 +564,7 @@ var _ = Describe("Podman create", func() {
})
It("create container in pod with mac should fail", func() {
- SkipIfRootless()
+ SkipIfRootless() //Setting MAC Address not supported in rootless mode
name := "createwithstaticmac"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
@@ -579,7 +576,6 @@ var _ = Describe("Podman create", func() {
})
It("create container in pod with network should fail", func() {
- SkipIfRootless()
name := "createwithnetwork"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
@@ -592,19 +588,17 @@ var _ = Describe("Podman create", func() {
})
It("create container in pod with ports should fail", func() {
- SkipIfRootless()
name := "createwithports"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
Expect(pod.ExitCode()).To(BeZero())
- session := podmanTest.Podman([]string{"create", "--pod", name, "-p", "80:80", ALPINE, "top"})
+ session := podmanTest.Podman([]string{"create", "--pod", name, "-p", "8080:80", ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).ToNot(BeZero())
})
It("create container in pod ppublish ports should fail", func() {
- SkipIfRootless()
name := "createwithpublishports"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 7bbbe2e03..bea8caa93 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -43,7 +43,6 @@ var _ = Describe("Podman events", func() {
// These tests are only known to work on Fedora ATM. Other distributions
// will be skipped.
It("podman events", func() {
- SkipIfRootless()
SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
@@ -53,7 +52,6 @@ var _ = Describe("Podman events", func() {
})
It("podman events with an event filter", func() {
- SkipIfRootless()
SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
@@ -65,7 +63,6 @@ var _ = Describe("Podman events", func() {
It("podman events with an event filter and container=cid", func() {
Skip("Does not work on v2")
- SkipIfRootless()
SkipIfNotFedora()
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
@@ -80,7 +77,6 @@ var _ = Describe("Podman events", func() {
})
It("podman events with a type and filter container=id", func() {
- SkipIfRootless()
SkipIfNotFedora()
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
@@ -91,7 +87,6 @@ var _ = Describe("Podman events", func() {
})
It("podman events with a type", func() {
- SkipIfRootless()
SkipIfNotFedora()
setup := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:foobarpod", ALPINE, "top"})
setup.WaitWithDefaultTimeout()
@@ -107,7 +102,6 @@ var _ = Describe("Podman events", func() {
})
It("podman events --since", func() {
- SkipIfRootless()
SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
@@ -117,7 +111,6 @@ var _ = Describe("Podman events", func() {
})
It("podman events --until", func() {
- SkipIfRootless()
SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
@@ -130,7 +123,6 @@ var _ = Describe("Podman events", func() {
})
It("podman events format", func() {
- SkipIfRootless()
SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index 055546f88..7d50c02b2 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -67,13 +67,14 @@ var _ = Describe("Podman exec", func() {
})
It("podman exec simple command using latest", func() {
- // the remote client doesn't use latest
- SkipIfRemote()
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
-
- session := podmanTest.Podman([]string{"exec", "-l", "ls"})
+ cid := "-l"
+ if IsRemote() {
+ cid = "test1"
+ }
+ session := podmanTest.Podman([]string{"exec", cid, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
@@ -122,13 +123,12 @@ var _ = Describe("Podman exec", func() {
})
It("podman exec terminal doesn't hang", func() {
- Skip(v2remotefail)
- setup := podmanTest.Podman([]string{"run", "-dti", fedoraMinimal, "sleep", "+Inf"})
+ setup := podmanTest.Podman([]string{"run", "-dti", "--name", "test1", fedoraMinimal, "sleep", "+Inf"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
for i := 0; i < 5; i++ {
- session := podmanTest.Podman([]string{"exec", "-lti", "true"})
+ session := podmanTest.Podman([]string{"exec", "-ti", "test1", "true"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
}
@@ -283,6 +283,35 @@ var _ = Describe("Podman exec", func() {
Expect(strings.Contains(exec.OutputToString(), fmt.Sprintf("%s(%s)", gid, groupName))).To(BeTrue())
})
+ It("podman exec preserves container groups with --user and --group-add", func() {
+ SkipIfRemote("FIXME: This is broken SECCOMP Failues?")
+
+ dockerfile := `FROM fedora-minimal
+RUN groupadd -g 4000 first
+RUN groupadd -g 4001 second
+RUN useradd -u 1000 auser`
+ imgName := "testimg"
+ podmanTest.BuildImage(dockerfile, imgName, "false")
+
+ ctrName := "testctr"
+ ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, "--user", "auser:first", "--group-add", "second", imgName, "sleep", "300"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(Equal(0))
+
+ exec := podmanTest.Podman([]string{"exec", "-t", ctrName, "id"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(Equal(0))
+ output := exec.OutputToString()
+ Expect(strings.Contains(output, "4000(first)")).To(BeTrue())
+ Expect(strings.Contains(output, "4001(second)")).To(BeTrue())
+ Expect(strings.Contains(output, "1000(auser)")).To(BeTrue())
+
+ // Kill the container just so the test does not take 15 seconds to stop.
+ kill := podmanTest.Podman([]string{"kill", ctrName})
+ kill.WaitWithDefaultTimeout()
+ Expect(kill.ExitCode()).To(Equal(0))
+ })
+
It("podman exec --detach", func() {
ctrName := "testctr"
ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, ALPINE, "top"})
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index e886c6000..a3a841dc6 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -3,6 +3,7 @@ package integration
import (
"os"
"path/filepath"
+ "strconv"
. "github.com/containers/podman/v2/test/utils"
"github.com/ghodss/yaml"
@@ -201,6 +202,39 @@ var _ = Describe("Podman generate kube", func() {
// Expect(err).To(BeNil())
})
+ It("podman generate kube on pod with restartPolicy", func() {
+ // podName, set, expect
+ testSli := [][]string{
+ {"testPod1", "", "Never"}, // some pod create from cmdline, so set it to Never
+ {"testPod2", "always", "Always"},
+ {"testPod3", "on-failure", "OnFailure"},
+ {"testPod4", "no", "Never"},
+ }
+
+ for k, v := range testSli {
+ podName := v[0]
+ podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
+ podSession.WaitWithDefaultTimeout()
+ Expect(podSession.ExitCode()).To(Equal(0))
+
+ ctrName := "ctr" + strconv.Itoa(k)
+ ctr1Session := podmanTest.Podman([]string{"create", "--name", ctrName, "--pod", podName,
+ "--restart", v[1], ALPINE, "top"})
+ ctr1Session.WaitWithDefaultTimeout()
+ Expect(ctr1Session.ExitCode()).To(Equal(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", podName})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+
+ Expect(string(pod.Spec.RestartPolicy)).To(Equal(v[2]))
+ }
+ })
+
It("podman generate kube on pod with ports", func() {
podName := "test"
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName, "-p", "4000:4000", "-p", "5000:5000"})
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index c020860ea..71e73af9c 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -174,7 +174,6 @@ var _ = Describe("Podman healthcheck run", func() {
})
It("podman healthcheck single healthy result changes failed to healthy", func() {
- Skip(v2remotefail)
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--health-retries", "2", "--health-cmd", "ls /foo || exit 1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index a615a9f99..d9ad10fe9 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -176,7 +176,7 @@ var _ = Describe("Podman images", func() {
})
It("podman images filter before image", func() {
- Skip(v2remotefail)
+ SkipIfRemote("FIXME This should work on podman-remote")
dockerfile := `FROM docker.io/library/alpine:latest
RUN apk update && apk add strace
`
@@ -189,7 +189,6 @@ RUN apk update && apk add strace
})
It("podman images workingdir from image", func() {
- Skip(v2remotefail)
dockerfile := `FROM docker.io/library/alpine:latest
WORKDIR /test
`
@@ -241,6 +240,38 @@ WORKDIR /test
Expect(result.OutputToStringArray()).Should(HaveLen(0), "dangling image output: %q", result.OutputToString())
})
+ It("podman pull by digest and list --all", func() {
+ // Prevent regressing on issue #7651.
+ digestPullAndList := func(noneTag bool) {
+ session := podmanTest.Podman([]string{"pull", ALPINEAMD64DIGEST})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ result := podmanTest.Podman([]string{"images", "--all", ALPINEAMD64DIGEST})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+
+ found, _ := result.GrepString("<none>")
+ if noneTag {
+ Expect(found).To(BeTrue())
+ } else {
+ Expect(found).To(BeFalse())
+ }
+ }
+ // No "<none>" tag as tagged alpine instances should be present.
+ session := podmanTest.Podman([]string{"pull", ALPINELISTTAG})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ digestPullAndList(false)
+
+ // Now remove all images, re-pull by digest and check for the "<none>" tag.
+ session = podmanTest.Podman([]string{"rmi", "-af"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ digestPullAndList(true)
+ })
+
It("podman check for image with sha256: prefix", func() {
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
@@ -309,7 +340,7 @@ WORKDIR /test
})
It("podman images --all flag", func() {
- Skip(v2remotefail)
+ SkipIfRemote("FIXME This should work on podman-remote")
podmanTest.RestoreAllArtifacts()
dockerfile := `FROM docker.io/library/alpine:latest
RUN mkdir hello
@@ -329,7 +360,6 @@ ENV foo=bar
})
It("podman images filter by label", func() {
- Skip(v2remotefail)
dockerfile := `FROM docker.io/library/alpine:latest
LABEL version="1.0"
LABEL "com.example.vendor"="Example Vendor"
@@ -342,7 +372,7 @@ LABEL "com.example.vendor"="Example Vendor"
})
It("podman with images with no layers", func() {
- Skip(v2remotefail)
+ SkipIfRemote("FIXME This should work on podman-remote")
dockerfile := strings.Join([]string{
`FROM scratch`,
`LABEL org.opencontainers.image.authors="<somefolks@example.org>"`,
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index 6ca75848c..bcbfdd80a 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -79,7 +79,7 @@ var _ = Describe("Podman Info", func() {
if !rootless.IsRootless() {
Skip("test of rootless_storage_path is only meaningful as rootless")
}
- SkipIfRemote()
+ SkipIfRemote("Only tests storage on local client")
oldHOME, hasHOME := os.LookupEnv("HOME")
defer func() {
if hasHOME {
diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go
index 068da5f2a..baa5c5717 100644
--- a/test/e2e/init_test.go
+++ b/test/e2e/init_test.go
@@ -75,7 +75,7 @@ var _ = Describe("Podman init", func() {
})
It("podman init latest container", func() {
- SkipIfRemote()
+ SkipIfRemote("--latest flag n/a")
session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index f7b953356..d4de7a65c 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -126,7 +126,7 @@ var _ = Describe("Podman inspect", func() {
})
It("podman inspect -l with additional input should fail", func() {
- SkipIfRemote()
+ SkipIfRemote("--latest flag n/a")
result := podmanTest.Podman([]string{"inspect", "-l", "1234foobar"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(125))
@@ -173,7 +173,7 @@ var _ = Describe("Podman inspect", func() {
})
It("podman inspect --latest with no container fails", func() {
- SkipIfRemote()
+ SkipIfRemote("testing --latest flag")
session := podmanTest.Podman([]string{"inspect", "--latest"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go
index 3984c3414..10976fd83 100644
--- a/test/e2e/kill_test.go
+++ b/test/e2e/kill_test.go
@@ -100,12 +100,15 @@ var _ = Describe("Podman kill", func() {
})
It("podman kill latest container", func() {
- SkipIfRemote()
- session := podmanTest.RunTopContainer("")
+ session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- result := podmanTest.Podman([]string{"kill", "-l"})
+ cid := "-l"
+ if IsRemote() {
+ cid = "test1"
+ }
+ result := podmanTest.Podman([]string{"kill", cid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index 874789b5e..0a0b2799b 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -19,8 +19,15 @@ import (
"github.com/onsi/ginkgo"
)
-func SkipIfRemote() {
- ginkgo.Skip("This function is not enabled for remote podman")
+func IsRemote() bool {
+ return true
+}
+
+func SkipIfRemote(reason string) {
+ ginkgo.Skip("[remote]: " + reason)
+}
+
+func SkipIfRootlessCgroupsV1() {
}
func SkipIfRootless() {
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index bfd898108..00d066fea 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -12,7 +12,17 @@ import (
. "github.com/onsi/ginkgo"
)
-func SkipIfRemote() {
+func IsRemote() bool {
+ return false
+}
+
+func SkipIfRemote(string) {
+}
+
+func SkipIfRootlessCgroupsV1() {
+ if os.Geteuid() != 0 && !CGROUPSV2 {
+ Skip("Rooless requires cgroupsV2 to set limits")
+ }
}
func SkipIfRootless() {
diff --git a/test/e2e/libpod_suite_varlink_test.go b/test/e2e/libpod_suite_varlink_test.go
index 750c8cd09..f901cbec9 100644
--- a/test/e2e/libpod_suite_varlink_test.go
+++ b/test/e2e/libpod_suite_varlink_test.go
@@ -19,8 +19,15 @@ import (
"github.com/onsi/ginkgo"
)
-func SkipIfRemote() {
- ginkgo.Skip("This function is not enabled for remote podman")
+func IsRemote() bool {
+ return true
+}
+
+func SkipIfRootlessCgroupsV1() {
+}
+
+func SkipIfRemote(reason string) {
+ ginkgo.Skip("[remote]: " + reason)
}
func SkipIfRootless() {
diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go
index 2b401a09d..ddffadac0 100644
--- a/test/e2e/load_test.go
+++ b/test/e2e/load_test.go
@@ -123,7 +123,7 @@ var _ = Describe("Podman load", func() {
})
It("podman load directory", func() {
- SkipIfRemote()
+ SkipIfRemote("Remote does not support loading directories")
outdir := filepath.Join(podmanTest.TempDir, "alpine")
save := podmanTest.PodmanNoCache([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
@@ -139,6 +139,22 @@ var _ = Describe("Podman load", func() {
Expect(result.ExitCode()).To(Equal(0))
})
+ It("podman-remote load directory", func() {
+ // Remote-only test looking for the specific remote error
+ // message when trying to load a directory.
+ if !IsRemote() {
+ Skip("Remote only test")
+ }
+
+ result := podmanTest.Podman([]string{"load", "-i", podmanTest.TempDir})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(125))
+
+ errMsg := fmt.Sprintf("remote client supports archives only but %q is a directory", podmanTest.TempDir)
+ found, _ := result.ErrorGrepString(errMsg)
+ Expect(found).Should(BeTrue())
+ })
+
It("podman load bogus file", func() {
save := podmanTest.PodmanNoCache([]string{"load", "-i", "foobar.tar"})
save.WaitWithDefaultTimeout()
@@ -227,7 +243,7 @@ var _ = Describe("Podman load", func() {
})
It("podman load localhost registry from dir", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME: podman-remote load is currently broken.")
outfile := filepath.Join(podmanTest.TempDir, "load")
setup := podmanTest.PodmanNoCache([]string{"tag", BB, "hello:world"})
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index e63bce3fe..3aa3cf409 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -127,7 +127,7 @@ var _ = Describe("Podman logs", func() {
})
It("two containers showing short container IDs", func() {
- SkipIfRemote() // remote does not support multiple containers
+ SkipIfRemote("FIXME: remote does not support multiple containers")
log1 := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
log1.WaitWithDefaultTimeout()
Expect(log1.ExitCode()).To(Equal(0))
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index 69b7b771b..33aac48d5 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -102,7 +102,7 @@ var _ = Describe("Podman manifest", func() {
})
It("podman manifest annotate", func() {
- SkipIfRemote()
+ SkipIfRemote("Not supporting annotate on remote connections")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -184,8 +184,7 @@ var _ = Describe("Podman manifest", func() {
})
It("podman manifest push purge", func() {
- // remote does not support --purge
- SkipIfRemote()
+ SkipIfRemote("remote does not support --purge")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go
index a2b448337..4f60cc6df 100644
--- a/test/e2e/mount_test.go
+++ b/test/e2e/mount_test.go
@@ -189,7 +189,7 @@ var _ = Describe("Podman mount", func() {
})
It("podman list running container", func() {
- SkipIfRootless()
+ SkipIfRootless() // FIXME: We need to do a podman unshare before executing this code.
setup := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
setup.WaitWithDefaultTimeout()
@@ -212,7 +212,7 @@ var _ = Describe("Podman mount", func() {
})
It("podman list multiple mounted containers", func() {
- SkipIfRootless()
+ SkipIfRootless() // FIXME: We need to do a podman unshare before executing this code.
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
@@ -257,7 +257,7 @@ var _ = Describe("Podman mount", func() {
})
It("podman list mounted container", func() {
- SkipIfRootless()
+ SkipIfRootless() // FIXME: We need to do a podman unshare before executing this code.
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
@@ -348,6 +348,25 @@ var _ = Describe("Podman mount", func() {
Expect(umount.ExitCode()).To(Equal(0))
})
+ It("podman umount --all", func() {
+ setup := podmanTest.PodmanNoCache([]string{"pull", fedoraMinimal})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ setup = podmanTest.PodmanNoCache([]string{"pull", ALPINE})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ mount := podmanTest.Podman([]string{"image", "mount", fedoraMinimal})
+ mount.WaitWithDefaultTimeout()
+ Expect(mount.ExitCode()).To(Equal(0))
+
+ umount := podmanTest.Podman([]string{"image", "umount", "--all"})
+ umount.WaitWithDefaultTimeout()
+ Expect(umount.ExitCode()).To(Equal(0))
+ Expect(len(umount.OutputToStringArray())).To(Equal(1))
+ })
+
It("podman mount many", func() {
setup := podmanTest.PodmanNoCache([]string{"pull", fedoraMinimal})
setup.WaitWithDefaultTimeout()
@@ -402,6 +421,10 @@ var _ = Describe("Podman mount", func() {
Expect(mount.ExitCode()).To(Equal(0))
Expect(mount.OutputToString()).To(Equal(""))
+ umount = podmanTest.PodmanNoCache([]string{"image", "umount", fedoraMinimal, ALPINE})
+ umount.WaitWithDefaultTimeout()
+ Expect(umount.ExitCode()).To(Equal(0))
+
mount1 = podmanTest.PodmanNoCache([]string{"image", "mount", "--all"})
mount1.WaitWithDefaultTimeout()
Expect(mount1.ExitCode()).To(Equal(0))
diff --git a/test/e2e/namespace_test.go b/test/e2e/namespace_test.go
index 916ceada0..92df3df48 100644
--- a/test/e2e/namespace_test.go
+++ b/test/e2e/namespace_test.go
@@ -33,7 +33,7 @@ var _ = Describe("Podman namespaces", func() {
})
It("podman namespace test", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on Remote")
podman1 := podmanTest.Podman([]string{"--namespace", "test1", "run", "-d", ALPINE, "echo", "hello"})
podman1.WaitWithDefaultTimeout()
Expect(podman1.ExitCode()).To(Equal(0))
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index 13d515d8e..f6d9f2cc3 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -137,7 +137,7 @@ var _ = Describe("Podman network create", func() {
})
It("podman network create with name and subnet", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME, this should work on --remote")
var (
results []network.NcList
)
@@ -178,8 +178,8 @@ var _ = Describe("Podman network create", func() {
})
It("podman network create with name and IPv6 subnet", func() {
- SkipIfRemote()
- SkipIfRootless()
+ SkipIfRootless() // FIXME I believe this should work in rootlessmode
+
var (
results []network.NcList
)
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index c35b82fc1..2ea8291fc 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -135,6 +135,7 @@ var _ = Describe("Podman network", func() {
})
It("podman network rm", func() {
+ SkipIfRootless() // FIXME: This one is definitely broken in rootless mode
// Setup, use uuid to prevent conflict with other tests
uuid := stringid.GenerateNonCryptoID()
secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid))
@@ -263,4 +264,54 @@ var _ = Describe("Podman network", func() {
rmAll.WaitWithDefaultTimeout()
Expect(rmAll.ExitCode()).To(BeZero())
})
+
+ It("podman network remove --force with pod", func() {
+ netName := "testnet"
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"pod", "create", "--network", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ podID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"create", "--pod", podID, ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"network", "rm", "--force", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ // check if pod is deleted
+ session = podmanTest.Podman([]string{"pod", "exists", podID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(1))
+
+ // check if net is deleted
+ session = podmanTest.Podman([]string{"network", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(session.OutputToString()).To(Not(ContainSubstring(netName)))
+ })
+
+ It("podman network remove with two networks", func() {
+ netName1 := "net1"
+ session := podmanTest.Podman([]string{"network", "create", netName1})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ netName2 := "net2"
+ session = podmanTest.Podman([]string{"network", "create", netName2})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"network", "rm", netName1, netName2})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ lines := session.OutputToStringArray()
+ Expect(lines[0]).To(Equal(netName1))
+ Expect(lines[1]).To(Equal(netName2))
+ })
})
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go
index db9f92e0c..a49304bbe 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -24,7 +24,7 @@ var _ = Describe("Podman pause", func() {
createdState := "created"
BeforeEach(func() {
- SkipIfRootless()
+ SkipIfRootlessCgroupsV1() // Pause is not supported in cgroups v1
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 87de92357..d771860d8 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -46,6 +46,7 @@ metadata:
{{ end }}
spec:
+ restartPolicy: {{ .RestartPolicy }}
hostname: {{ .Hostname }}
hostAliases:
{{ range .HostAliases }}
@@ -158,13 +159,14 @@ spec:
{{- with .Labels }}{{ range $key, $value := . }}
{{ $key }}: {{ $value }}
{{- end }}{{ end }}
- {{ with .Annotations }}
- annotations:
- {{ range $key, $value := . }}
- {{ $key }}: {{ $value }}
- {{ end }}
- {{ end }}
+ {{- with .Annotations }}
+ annotations:
+ {{- range $key, $value := . }}
+ {{ $key }}: {{ $value }}
+ {{- end }}
+ {{- end }}
spec:
+ restartPolicy: {{ .RestartPolicy }}
hostname: {{ .Hostname }}
containers:
{{ with .Ctrs }}
@@ -274,13 +276,14 @@ func generateDeploymentKubeYaml(deployment *Deployment, fileName string) error {
// Pod describes the options a kube yaml can be configured at pod level
type Pod struct {
- Name string
- Hostname string
- HostAliases []HostAlias
- Ctrs []*Ctr
- Volumes []*Volume
- Labels map[string]string
- Annotations map[string]string
+ Name string
+ RestartPolicy string
+ Hostname string
+ HostAliases []HostAlias
+ Ctrs []*Ctr
+ Volumes []*Volume
+ Labels map[string]string
+ Annotations map[string]string
}
type HostAlias struct {
@@ -293,13 +296,14 @@ type HostAlias struct {
// if no containers are added, it will add the default container
func getPod(options ...podOption) *Pod {
p := Pod{
- Name: defaultPodName,
- Hostname: "",
- HostAliases: nil,
- Ctrs: make([]*Ctr, 0),
- Volumes: make([]*Volume, 0),
- Labels: make(map[string]string),
- Annotations: make(map[string]string),
+ Name: defaultPodName,
+ RestartPolicy: "Never",
+ Hostname: "",
+ HostAliases: nil,
+ Ctrs: make([]*Ctr, 0),
+ Volumes: make([]*Volume, 0),
+ Labels: make(map[string]string),
+ Annotations: make(map[string]string),
}
for _, option := range options {
option(&p)
@@ -312,6 +316,12 @@ func getPod(options ...podOption) *Pod {
type podOption func(*Pod)
+func withPodName(name string) podOption {
+ return func(pod *Pod) {
+ pod.Name = name
+ }
+}
+
func withHostname(h string) podOption {
return func(pod *Pod) {
pod.Hostname = h
@@ -333,6 +343,12 @@ func withCtr(c *Ctr) podOption {
}
}
+func withRestartPolicy(policy string) podOption {
+ return func(pod *Pod) {
+ pod.RestartPolicy = policy
+ }
+}
+
func withLabel(k, v string) podOption {
return func(pod *Pod) {
pod.Labels[k] = v
@@ -575,7 +591,6 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman play kube test correct command", func() {
- SkipIfRemote()
pod := getPod()
err := generatePodKubeYaml(pod, kubeYaml)
Expect(err).To(BeNil())
@@ -593,7 +608,6 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman play kube test correct command with only set command in yaml file", func() {
- SkipIfRemote()
pod := getPod(withCtr(getCtr(withCmd([]string{"echo", "hello"}), withArg(nil))))
err := generatePodKubeYaml(pod, kubeYaml)
Expect(err).To(BeNil())
@@ -628,7 +642,6 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman play kube test correct output", func() {
- SkipIfRemote()
p := getPod(withCtr(getCtr(withCmd([]string{"echo", "hello"}), withArg([]string{"world"}))))
err := generatePodKubeYaml(p, kubeYaml)
@@ -649,6 +662,30 @@ var _ = Describe("Podman generate kube", func() {
Expect(inspect.OutputToString()).To(ContainSubstring(`[echo hello world]`))
})
+ It("podman play kube test restartPolicy", func() {
+ // podName, set, expect
+ testSli := [][]string{
+ {"testPod1", "", "always"}, // Default eqaul to always
+ {"testPod2", "Always", "always"},
+ {"testPod3", "OnFailure", "on-failure"},
+ {"testPod4", "Never", "no"},
+ }
+ for _, v := range testSli {
+ pod := getPod(withPodName(v[0]), withRestartPolicy(v[1]))
+ err := generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{.HostConfig.RestartPolicy.Name}}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect.OutputToString()).To(Equal(v[2]))
+ }
+ })
+
It("podman play kube test hostname", func() {
pod := getPod()
err := generatePodKubeYaml(pod, kubeYaml)
@@ -756,7 +793,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman play kube seccomp container level", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This is broken")
// expect play kube is expected to set a seccomp label if it's applied as an annotation
jsonFile, err := podmanTest.CreateSeccompJson(seccompPwdEPERM)
if err != nil {
@@ -783,7 +820,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman play kube seccomp pod level", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME: This should work with --remote")
// expect play kube is expected to set a seccomp label if it's applied as an annotation
jsonFile, err := podmanTest.CreateSeccompJson(seccompPwdEPERM)
if err != nil {
@@ -935,7 +972,6 @@ spec:
// Deployment related tests
It("podman play kube deployment 1 replica test correct command", func() {
- SkipIfRemote()
deployment := getDeployment()
err := generateDeploymentKubeYaml(deployment, kubeYaml)
Expect(err).To(BeNil())
@@ -954,7 +990,6 @@ spec:
})
It("podman play kube deployment more than 1 replica test correct command", func() {
- SkipIfRemote()
var i, numReplicas int32
numReplicas = 5
deployment := getDeployment(withReplicas(numReplicas))
@@ -1120,7 +1155,6 @@ spec:
})
It("podman play kube applies labels to pods", func() {
- SkipIfRemote()
var numReplicas int32 = 5
expectedLabelKey := "key1"
expectedLabelValue := "value1"
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index c540b6e54..f69b6ca7b 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -124,7 +124,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with --no-hosts", func() {
- SkipIfRemote()
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--no-hosts", "--name", name})
podCreate.WaitWithDefaultTimeout()
@@ -141,7 +140,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with --no-hosts and no infra should fail", func() {
- SkipIfRemote()
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--no-hosts", "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
@@ -149,7 +147,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with --add-host", func() {
- SkipIfRemote()
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--add-host", "test.example.com:12.34.56.78", "--name", name})
podCreate.WaitWithDefaultTimeout()
@@ -162,7 +159,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with --add-host and no infra should fail", func() {
- SkipIfRemote()
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--add-host", "test.example.com:12.34.56.78", "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
@@ -170,7 +166,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with DNS server set", func() {
- SkipIfRemote()
name := "test"
server := "12.34.56.78"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns", server, "--name", name})
@@ -184,7 +179,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with DNS server set and no infra should fail", func() {
- SkipIfRemote()
name := "test"
server := "12.34.56.78"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns", server, "--name", name, "--infra=false"})
@@ -193,7 +187,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with DNS option set", func() {
- SkipIfRemote()
name := "test"
option := "attempts:5"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns-opt", option, "--name", name})
@@ -207,7 +200,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with DNS option set and no infra should fail", func() {
- SkipIfRemote()
name := "test"
option := "attempts:5"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns-opt", option, "--name", name, "--infra=false"})
@@ -216,7 +208,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with DNS search domain set", func() {
- SkipIfRemote()
name := "test"
search := "example.com"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns-search", search, "--name", name})
@@ -230,7 +221,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with DNS search domain set and no infra should fail", func() {
- SkipIfRemote()
name := "test"
search := "example.com"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns-search", search, "--name", name, "--infra=false"})
@@ -256,7 +246,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with IP address and no infra should fail", func() {
- SkipIfRemote()
name := "test"
ip := GetRandomIPAddress()
podCreate := podmanTest.Podman([]string{"pod", "create", "--ip", ip, "--name", name, "--infra=false"})
@@ -265,7 +254,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with MAC address", func() {
- SkipIfRemote()
name := "test"
mac := "92:d0:c6:0a:29:35"
podCreate := podmanTest.Podman([]string{"pod", "create", "--mac-address", mac, "--name", name})
@@ -283,7 +271,6 @@ var _ = Describe("Podman pod create", func() {
})
It("podman create pod with MAC address and no infra should fail", func() {
- SkipIfRemote()
name := "test"
mac := "92:d0:c6:0a:29:35"
podCreate := podmanTest.Podman([]string{"pod", "create", "--mac-address", mac, "--name", name, "--infra=false"})
@@ -345,6 +332,12 @@ var _ = Describe("Podman pod create", func() {
check1.WaitWithDefaultTimeout()
Expect(check1.ExitCode()).To(Equal(0))
Expect(check1.OutputToString()).To(Equal("/pause"))
+
+ // check the Path and Args
+ check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
+ check2.WaitWithDefaultTimeout()
+ Expect(check2.ExitCode()).To(Equal(0))
+ Expect(check2.OutputToString()).To(Equal("/pause:[/pause]"))
})
It("podman create pod with --infra-command", func() {
@@ -362,6 +355,12 @@ var _ = Describe("Podman pod create", func() {
check1.WaitWithDefaultTimeout()
Expect(check1.ExitCode()).To(Equal(0))
Expect(check1.OutputToString()).To(Equal("/pause1"))
+
+ // check the Path and Args
+ check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
+ check2.WaitWithDefaultTimeout()
+ Expect(check2.ExitCode()).To(Equal(0))
+ Expect(check2.OutputToString()).To(Equal("/pause1:[/pause1]"))
})
It("podman create pod with --infra-image", func() {
@@ -383,6 +382,12 @@ entrypoint ["/fromimage"]
check1.WaitWithDefaultTimeout()
Expect(check1.ExitCode()).To(Equal(0))
Expect(check1.OutputToString()).To(Equal("/fromimage"))
+
+ // check the Path and Args
+ check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
+ check2.WaitWithDefaultTimeout()
+ Expect(check2.ExitCode()).To(Equal(0))
+ Expect(check2.OutputToString()).To(Equal("/fromimage:[/fromimage]"))
})
It("podman create pod with --infra-command --infra-image", func() {
@@ -404,6 +409,12 @@ entrypoint ["/fromimage"]
check1.WaitWithDefaultTimeout()
Expect(check1.ExitCode()).To(Equal(0))
Expect(check1.OutputToString()).To(Equal("/fromcommand"))
+
+ // check the Path and Args
+ check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
+ check2.WaitWithDefaultTimeout()
+ Expect(check2.ExitCode()).To(Equal(0))
+ Expect(check2.OutputToString()).To(Equal("/fromcommand:[/fromcommand]"))
})
It("podman create pod with slirp network option", func() {
diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go
index 98f1b5174..515391f92 100644
--- a/test/e2e/pod_infra_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -225,7 +225,7 @@ var _ = Describe("Podman pod create", func() {
})
It("podman pod container can override pod pid NS", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.Podman([]string{"pod", "create", "--share", "pid"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -257,7 +257,7 @@ var _ = Describe("Podman pod create", func() {
})
It("podman pod container can override pod not sharing pid", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.Podman([]string{"pod", "create", "--share", "net"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -283,7 +283,7 @@ var _ = Describe("Podman pod create", func() {
})
It("podman pod container can override pod ipc NS", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -380,6 +380,7 @@ var _ = Describe("Podman pod create", func() {
})
It("podman run --add-host in pod", func() {
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go
index d7462e16d..f968f73a6 100644
--- a/test/e2e/pod_kill_test.go
+++ b/test/e2e/pod_kill_test.go
@@ -100,7 +100,6 @@ var _ = Describe("Podman pod kill", func() {
})
It("podman pod kill latest pod", func() {
- SkipIfRemote()
_, ec, podid := podmanTest.CreatePod("")
Expect(ec).To(Equal(0))
@@ -118,8 +117,10 @@ var _ = Describe("Podman pod kill", func() {
session = podmanTest.RunTopContainerInPod("", podid2)
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
-
- result := podmanTest.Podman([]string{"pod", "kill", "-l"})
+ if !IsRemote() {
+ podid2 = "-l"
+ }
+ result := podmanTest.Podman([]string{"pod", "kill", podid2})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go
index ec06b7df7..182d99d51 100644
--- a/test/e2e/pod_pause_test.go
+++ b/test/e2e/pod_pause_test.go
@@ -18,7 +18,7 @@ var _ = Describe("Podman pod pause", func() {
pausedState := "paused"
BeforeEach(func() {
- SkipIfRootless()
+ SkipIfRootlessCgroupsV1() // Pause is not supported in cgroups v1
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/pod_pod_namespaces.go b/test/e2e/pod_pod_namespaces.go
index f72f98b5f..3139bf561 100644
--- a/test/e2e/pod_pod_namespaces.go
+++ b/test/e2e/pod_pod_namespaces.go
@@ -61,7 +61,7 @@ var _ = Describe("Podman pod create", func() {
})
It("podman pod container dontshare PIDNS", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index 602d9d577..17ed6a9c0 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -83,7 +83,7 @@ var _ = Describe("Podman ps", func() {
})
It("podman pod ps latest", func() {
- SkipIfRemote()
+ SkipIfRemote("--latest flag n/a")
_, ec, podid1 := podmanTest.CreatePod("")
Expect(ec).To(Equal(0))
@@ -212,17 +212,17 @@ var _ = Describe("Podman ps", func() {
Expect(ec).To(Equal(0))
_, ec, podid2 := podmanTest.CreatePodWithLabels("", map[string]string{
- "io.podman.test.label": "value1",
- "io.podman.test.key": "irrelevant-value",
+ "app": "myapp",
+ "io.podman.test.key": "irrelevant-value",
})
Expect(ec).To(Equal(0))
_, ec, podid3 := podmanTest.CreatePodWithLabels("", map[string]string{
- "io.podman.test.label": "value2",
+ "app": "test",
})
Expect(ec).To(Equal(0))
- session := podmanTest.Podman([]string{"pod", "ps", "--no-trunc", "--filter", "label=io.podman.test.key", "--filter", "label=io.podman.test.label=value1"})
+ session := podmanTest.Podman([]string{"pod", "ps", "--no-trunc", "--filter", "label=app", "--filter", "label=app=myapp"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid1)))
diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go
index 9fe6c1a85..b358c2c7a 100644
--- a/test/e2e/pod_restart_test.go
+++ b/test/e2e/pod_restart_test.go
@@ -134,7 +134,6 @@ var _ = Describe("Podman pod restart", func() {
})
It("podman pod restart latest pod", func() {
- SkipIfRemote()
_, ec, _ := podmanTest.CreatePod("foobar99")
Expect(ec).To(Equal(0))
@@ -152,7 +151,11 @@ var _ = Describe("Podman pod restart", func() {
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
startTime.WaitWithDefaultTimeout()
- session = podmanTest.Podman([]string{"pod", "restart", "-l"})
+ podid := "-l"
+ if IsRemote() {
+ podid = "foobar100"
+ }
+ session = podmanTest.Podman([]string{"pod", "restart", podid})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index 918d0eb32..cb9b93a15 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -61,14 +61,17 @@ var _ = Describe("Podman pod rm", func() {
})
It("podman pod rm latest pod", func() {
- SkipIfRemote()
_, ec, podid := podmanTest.CreatePod("")
Expect(ec).To(Equal(0))
- _, ec2, podid2 := podmanTest.CreatePod("")
+ _, ec2, podid2 := podmanTest.CreatePod("pod2")
Expect(ec2).To(Equal(0))
- result := podmanTest.Podman([]string{"pod", "rm", "--latest"})
+ latest := "--latest"
+ if IsRemote() {
+ latest = "pod2"
+ }
+ result := podmanTest.Podman([]string{"pod", "rm", latest})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go
index 2f0160e99..63a915548 100644
--- a/test/e2e/pod_start_test.go
+++ b/test/e2e/pod_start_test.go
@@ -107,7 +107,6 @@ var _ = Describe("Podman pod start", func() {
})
It("podman pod start latest pod", func() {
- SkipIfRemote()
_, ec, _ := podmanTest.CreatePod("foobar99")
Expect(ec).To(Equal(0))
@@ -122,7 +121,11 @@ var _ = Describe("Podman pod start", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"pod", "start", "--latest"})
+ podid := "--latest"
+ if IsRemote() {
+ podid = "foobar100"
+ }
+ session = podmanTest.Podman([]string{"pod", "start", podid})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index 04475a799..02fb3bc57 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -175,7 +175,7 @@ var _ = Describe("Podman pod stats", func() {
It("podman stats on net=host post", func() {
// --net=host not supported for rootless pods at present
- SkipIfRootless()
+ SkipIfRootlessCgroupsV1() // Pause stats not supported in cgroups v1
podName := "testPod"
podCreate := podmanTest.Podman([]string{"pod", "create", "--net=host", "--name", podName})
podCreate.WaitWithDefaultTimeout()
diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go
index 2363974cc..4eb897786 100644
--- a/test/e2e/pod_stop_test.go
+++ b/test/e2e/pod_stop_test.go
@@ -143,7 +143,6 @@ var _ = Describe("Podman pod stop", func() {
})
It("podman pod stop latest pod", func() {
- SkipIfRemote()
_, ec, _ := podmanTest.CreatePod("foobar99")
Expect(ec).To(Equal(0))
@@ -158,7 +157,11 @@ var _ = Describe("Podman pod stop", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"pod", "stop", "--latest"})
+ podid := "--latest"
+ if IsRemote() {
+ podid = "foobar100"
+ }
+ session = podmanTest.Podman([]string{"pod", "stop", podid})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go
index 2cb7a623e..9e3570360 100644
--- a/test/e2e/pod_top_test.go
+++ b/test/e2e/pod_top_test.go
@@ -56,7 +56,6 @@ var _ = Describe("Podman top", func() {
})
It("podman pod top on pod", func() {
- SkipIfRemote()
_, ec, podid := podmanTest.CreatePod("")
Expect(ec).To(Equal(0))
@@ -64,7 +63,10 @@ var _ = Describe("Podman top", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- result := podmanTest.Podman([]string{"pod", "top", "-l"})
+ if !IsRemote() {
+ podid = "-l"
+ }
+ result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go
index fce092e2d..a3ce8bd69 100644
--- a/test/e2e/port_test.go
+++ b/test/e2e/port_test.go
@@ -47,15 +47,17 @@ var _ = Describe("Podman port", func() {
})
It("podman port -l nginx", func() {
- SkipIfRemote()
- session, cid := podmanTest.RunNginxWithHealthCheck("")
+ session, cid := podmanTest.RunNginxWithHealthCheck("test1")
Expect(session.ExitCode()).To(Equal(0))
if err := podmanTest.RunHealthCheck(cid); err != nil {
Fail(err.Error())
}
- result := podmanTest.Podman([]string{"port", "-l"})
+ if !IsRemote() {
+ cid = "-l"
+ }
+ result := podmanTest.Podman([]string{"port", cid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
@@ -63,7 +65,6 @@ var _ = Describe("Podman port", func() {
})
It("podman container port -l nginx", func() {
- SkipIfRemote()
session, cid := podmanTest.RunNginxWithHealthCheck("")
Expect(session.ExitCode()).To(Equal(0))
@@ -71,7 +72,10 @@ var _ = Describe("Podman port", func() {
Fail(err.Error())
}
- result := podmanTest.Podman([]string{"container", "port", "-l"})
+ if !IsRemote() {
+ cid = "-l"
+ }
+ result := podmanTest.Podman([]string{"container", "port", cid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
@@ -79,7 +83,6 @@ var _ = Describe("Podman port", func() {
})
It("podman port -l port nginx", func() {
- SkipIfRemote()
session, cid := podmanTest.RunNginxWithHealthCheck("")
Expect(session.ExitCode()).To(Equal(0))
@@ -87,7 +90,10 @@ var _ = Describe("Podman port", func() {
Fail(err.Error())
}
- result := podmanTest.Podman([]string{"port", "-l", "80"})
+ if !IsRemote() {
+ cid = "-l"
+ }
+ result := podmanTest.Podman([]string{"port", cid, "80"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 9c9d85194..24b88bfdd 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -88,7 +88,7 @@ var _ = Describe("Podman prune", func() {
})
It("podman image prune skip cache images", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME should work on podman --remote")
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
none := podmanTest.Podman([]string{"images", "-a"})
@@ -110,7 +110,7 @@ var _ = Describe("Podman prune", func() {
})
It("podman image prune dangling images", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
@@ -147,7 +147,7 @@ var _ = Describe("Podman prune", func() {
})
It("podman system image prune unused images", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
podmanTest.RestoreAllArtifacts()
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
prune := podmanTest.PodmanNoCache([]string{"system", "prune", "-a", "--force"})
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 66233412c..aabec4f55 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -101,7 +101,7 @@ var _ = Describe("Podman ps", func() {
})
It("podman ps latest flag", func() {
- SkipIfRemote()
+ SkipIfRemote("--latest is not supported on podman-remote")
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
_, ec, _ = podmanTest.RunLsContainer("")
@@ -400,18 +400,17 @@ var _ = Describe("Podman ps", func() {
})
It("podman ps test with port range", func() {
- SkipIfRootless()
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"run", "-dt", "-p", "1000-1006:1000-1006", ALPINE, "top"})
+ session = podmanTest.Podman([]string{"run", "-dt", "-p", "2000-2006:2000-2006", ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"ps", "--format", "{{.Ports}}"})
session.WaitWithDefaultTimeout()
- Expect(session.OutputToString()).To(ContainSubstring("0.0.0.0:1000-1006"))
+ Expect(session.OutputToString()).To(ContainSubstring("0.0.0.0:2000-2006"))
})
It("podman ps sync flag", func() {
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index 98b81876a..2280d16cc 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -235,7 +235,7 @@ var _ = Describe("Podman pull", func() {
})
It("podman pull from docker-archive", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
podmanTest.RestoreArtifact(ALPINE)
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.PodmanNoCache([]string{"save", "-o", tarfn, "alpine"})
@@ -297,7 +297,7 @@ var _ = Describe("Podman pull", func() {
})
It("podman pull from oci-archive", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
podmanTest.RestoreArtifact(ALPINE)
tarfn := filepath.Join(podmanTest.TempDir, "oci-alp.tar")
session := podmanTest.PodmanNoCache([]string{"save", "--format", "oci-archive", "-o", tarfn, "alpine"})
@@ -316,7 +316,7 @@ var _ = Describe("Podman pull", func() {
})
It("podman pull from local directory", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
podmanTest.RestoreArtifact(ALPINE)
dirpath := filepath.Join(podmanTest.TempDir, "alpine")
os.MkdirAll(dirpath, os.ModePerm)
@@ -341,7 +341,7 @@ var _ = Describe("Podman pull", func() {
})
It("podman pull from local OCI directory", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
podmanTest.RestoreArtifact(ALPINE)
dirpath := filepath.Join(podmanTest.TempDir, "alpine")
os.MkdirAll(dirpath, os.ModePerm)
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 1ff2095c0..9d2daaf9d 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -87,7 +87,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to local registry with authorization", func() {
- SkipIfRootless()
+ SkipIfRootless() // FIXME: Creating content in certs.d we use directories in homedir
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index 4348eae3b..789b4dee5 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -122,7 +122,6 @@ var _ = Describe("Podman restart", func() {
})
It("Podman restart the latest container", func() {
- SkipIfRemote()
_, exitCode, _ := podmanTest.RunLsContainer("test1")
Expect(exitCode).To(Equal(0))
@@ -132,7 +131,11 @@ var _ = Describe("Podman restart", func() {
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
startTime.WaitWithDefaultTimeout()
- session := podmanTest.Podman([]string{"restart", "-l"})
+ cid := "-l"
+ if IsRemote() {
+ cid = "test2"
+ }
+ session := podmanTest.Podman([]string{"restart", cid})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go
index 764d25ba5..cc2f7daf1 100644
--- a/test/e2e/rm_test.go
+++ b/test/e2e/rm_test.go
@@ -123,15 +123,18 @@ var _ = Describe("Podman rm", func() {
})
It("podman rm the latest container", func() {
- SkipIfRemote()
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- _, ec, cid := podmanTest.RunLsContainer("")
+ _, ec, cid := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
- result := podmanTest.Podman([]string{"rm", "-l"})
+ latest := "-l"
+ if IsRemote() {
+ latest = "test1"
+ }
+ result := podmanTest.Podman([]string{"rm", latest})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
output := result.OutputToString()
@@ -193,7 +196,7 @@ var _ = Describe("Podman rm", func() {
})
It("podman rm invalid --latest and --cidfile and --all", func() {
- SkipIfRemote()
+ SkipIfRemote("Verifying --latest flag")
result := podmanTest.Podman([]string{"rm", "--cidfile", "foobar", "--latest"})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index 4db6a1962..8a5014899 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -185,7 +185,7 @@ var _ = Describe("Podman rmi", func() {
})
It("podman rmi with cached images", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.PodmanNoCache([]string{"rmi", "-fa"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -255,7 +255,7 @@ var _ = Describe("Podman rmi", func() {
})
It("podman rmi -a with parent|child images", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
dockerfile := `FROM docker.io/library/alpine:latest AS base
RUN touch /1
ENV LOCAL=/1
diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go
index 7d522a752..0faf0b496 100644
--- a/test/e2e/run_apparmor_test.go
+++ b/test/e2e/run_apparmor_test.go
@@ -106,7 +106,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
parse := SystemExec("apparmor_parser", []string{"-Kr", aaFile})
Expect(parse.ExitCode()).To(Equal(0))
- session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=aa-test-profile", "ls"})
+ session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=aa-test-profile", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go
index 992f3eda2..b10937953 100644
--- a/test/e2e/run_cgroup_parent_test.go
+++ b/test/e2e/run_cgroup_parent_test.go
@@ -18,7 +18,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
)
BeforeEach(func() {
- SkipIfRootless()
+ SkipIfRootlessCgroupsV1() // cgroup parent is not supported in cgroups v1
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
@@ -48,6 +48,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
})
Specify("no --cgroup-parent", func() {
+ SkipIfRootless() // FIXME This seems to be broken in rootless mode
cgroup := "/libpod_parent"
if !Containerized() && podmanTest.CgroupManager != "cgroupfs" {
cgroup = "/machine.slice"
diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go
index f293e709a..34b6ba4ff 100644
--- a/test/e2e/run_cleanup_test.go
+++ b/test/e2e/run_cleanup_test.go
@@ -33,8 +33,8 @@ var _ = Describe("Podman run exit", func() {
})
It("podman run -d mount cleanup test", func() {
- SkipIfRemote()
- SkipIfRootless()
+ SkipIfRemote("podman-remote does not support mount")
+ SkipIfRootless() // FIXME podman mount requires podman unshare first
result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go
index 401447579..86cc9d1c5 100644
--- a/test/e2e/run_cpu_test.go
+++ b/test/e2e/run_cpu_test.go
@@ -18,6 +18,8 @@ var _ = Describe("Podman run cpu", func() {
)
BeforeEach(func() {
+ SkipIfRootlessCgroupsV1()
+
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
@@ -45,13 +47,8 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpu-period", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
var result *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"})
} else {
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
@@ -62,14 +59,9 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpu-quota", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
var result *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"})
} else {
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
@@ -80,12 +72,7 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpus", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
- if cgroupsv2 {
+ if CGROUPSV2 {
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
@@ -104,12 +91,7 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpu-shares", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
- if cgroupsv2 {
+ if CGROUPSV2 {
// [2-262144] is mapped to [1-10000]
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=262144", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.weight"})
result.WaitWithDefaultTimeout()
@@ -124,14 +106,9 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpuset-cpus", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
var result *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpuset.cpus.effective"})
} else {
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"})
@@ -142,14 +119,9 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpuset-mems", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
var result *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpuset.mems.effective"})
} else {
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"})
diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go
index 43c258eac..828da3494 100644
--- a/test/e2e/run_device_test.go
+++ b/test/e2e/run_device_test.go
@@ -72,7 +72,7 @@ var _ = Describe("Podman run device", func() {
})
It("podman run device host device and container device parameter are directories", func() {
- SkipIfRootless()
+ SkipIfRootless() // Can not create devices in /dev in rootless mode
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(BeNil())
defer os.RemoveAll("/dev/foodevdir")
diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go
index 0ec2535aa..ff018f5d8 100644
--- a/test/e2e/run_dns_test.go
+++ b/test/e2e/run_dns_test.go
@@ -93,7 +93,6 @@ var _ = Describe("Podman run dns", func() {
})
It("podman run add hostname sets /etc/hosts", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-t", "-i", "--hostname=foobar", ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index c1061be85..13a9abf9b 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -44,7 +44,6 @@ CMD []
})
It("podman run entrypoint", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
`
@@ -56,7 +55,6 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
})
It("podman run entrypoint with cmd", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
CMD [ "-v"]
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
@@ -69,7 +67,6 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
})
It("podman run entrypoint with user cmd overrides image cmd", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
CMD [ "-v"]
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
@@ -82,7 +79,6 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
})
It("podman run entrypoint with user cmd no image cmd", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
`
@@ -94,7 +90,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
})
It("podman run user entrypoint overrides image entrypoint and image cmd", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
dockerfile := `FROM docker.io/library/alpine:latest
CMD ["-i"]
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
@@ -112,7 +108,6 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
})
It("podman run user entrypoint with command overrides image entrypoint and image cmd", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
CMD ["-i"]
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go
index 801a3d014..3f488ada5 100644
--- a/test/e2e/run_env_test.go
+++ b/test/e2e/run_env_test.go
@@ -90,7 +90,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run --env-host environment test", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME, We should check that --env-host reports correct error on podman-remote")
env := append(os.Environ(), "FOO=BAR")
session := podmanTest.PodmanAsUser([]string{"run", "--rm", "--env-host", ALPINE, "/bin/printenv", "FOO"}, 0, 0, "", env)
@@ -108,7 +108,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run --http-proxy test", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME: Should report proper error when http-proxy is not supported")
os.Setenv("http_proxy", "1.2.3.4")
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "http_proxy"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index 21ad00b43..a3dc9bae5 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -17,6 +17,8 @@ var _ = Describe("Podman run memory", func() {
)
BeforeEach(func() {
+ SkipIfRootlessCgroupsV1()
+
SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index c20bfe631..a67324b2b 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -55,7 +55,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run network expose port 222", func() {
- SkipIfRootless()
+ SkipIfRootless() // iptables is not supported for rootless users
session := podmanTest.Podman([]string{"run", "-dt", "--expose", "222-223", "-P", ALPINE, "/bin/sh"})
session.Wait(30)
Expect(session.ExitCode()).To(Equal(0))
@@ -252,7 +252,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run network expose host port 80 to container port 8000", func() {
- SkipIfRootless()
+ SkipIfRootless() // iptables is not supported for rootless users
session := podmanTest.Podman([]string{"run", "-dt", "-p", "80:8000", ALPINE, "/bin/sh"})
session.Wait(30)
Expect(session.ExitCode()).To(Equal(0))
@@ -367,7 +367,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run network expose duplicate host port results in error", func() {
- SkipIfRootless()
+ SkipIfRootless() // FIXME we should be able to run this test in rootless mode with different ports
session := podmanTest.Podman([]string{"run", "--name", "test", "-dt", "-p", "80", ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
@@ -441,7 +441,6 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run --net container: copies hosts and resolv", func() {
- SkipIfRootless()
ctrName := "ctr1"
ctr1 := podmanTest.RunTopContainer(ctrName)
ctr1.WaitWithDefaultTimeout()
@@ -479,7 +478,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run network in user created network namespace", func() {
- SkipIfRootless()
+ SkipIfRootless() // ip netns is not supported for rootless users
if Containerized() {
Skip("Can not be run within a container.")
}
@@ -496,7 +495,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run n user created network namespace with resolv.conf", func() {
- SkipIfRootless()
+ SkipIfRootless() // ip netns is not supported for rootless users
if Containerized() {
Skip("Can not be run within a container.")
}
@@ -528,8 +527,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run in custom CNI network with --static-ip", func() {
- SkipIfRemote()
- SkipIfRootless()
+ SkipIfRootless() //Rootless mode does not support --ip
netName := "podmantestnetwork"
ipAddr := "10.25.30.128"
create := podmanTest.Podman([]string{"network", "create", "--subnet", "10.25.30.0/24", netName})
@@ -544,8 +542,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run with new:pod and static-ip", func() {
- SkipIfRemote()
- SkipIfRootless()
+ SkipIfRootless() // Rootless does not support --ip
netName := "podmantestnetwork2"
ipAddr := "10.25.40.128"
podname := "testpod"
diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go
index dfb8c72a1..e7b86c68b 100644
--- a/test/e2e/run_passwd_test.go
+++ b/test/e2e/run_passwd_test.go
@@ -60,7 +60,6 @@ var _ = Describe("Podman run passwd", func() {
})
It("podman can run container without /etc/passwd", func() {
- SkipIfRemote()
dockerfile := `FROM alpine
RUN rm -f /etc/passwd /etc/shadow /etc/group
USER 1000`
@@ -114,7 +113,6 @@ USER 1000`
})
It("podman run numeric group from image and no group file", func() {
- SkipIfRemote()
dockerfile := `FROM alpine
RUN rm -f /etc/passwd /etc/shadow /etc/group
USER 1000`
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index 064ba7d2c..a20088776 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -17,17 +17,19 @@ import (
// available than we are aware of, leading to host=FFF... and ctr=3FF...
// because the latter is all we request. Accept that.
func containerCapMatchesHost(ctr_cap string, host_cap string) {
+ if isRootless() {
+ return
+ }
ctr_cap_n, err := strconv.ParseUint(ctr_cap, 16, 64)
Expect(err).NotTo(HaveOccurred(), "Error parsing %q as hex", ctr_cap)
host_cap_n, err := strconv.ParseUint(host_cap, 16, 64)
Expect(err).NotTo(HaveOccurred(), "Error parsing %q as hex", host_cap)
- // host caps can never be zero (except rootless, which we don't test).
+ // host caps can never be zero (except rootless).
// and host caps must always be a superset (inclusive) of container
Expect(host_cap_n).To(BeNumerically(">", 0), "host cap %q should be nonzero", host_cap)
Expect(host_cap_n).To(BeNumerically(">=", ctr_cap_n), "host cap %q should never be less than container cap %q", host_cap, ctr_cap)
-
host_cap_masked := host_cap_n & (1<<len(capability.List()) - 1)
Expect(ctr_cap_n).To(Equal(host_cap_masked), "container cap %q is not a subset of host cap %q", ctr_cap, host_cap)
}
@@ -66,7 +68,6 @@ var _ = Describe("Podman privileged container tests", func() {
})
It("podman privileged CapEff", func() {
- SkipIfRootless()
host_cap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
Expect(host_cap.ExitCode()).To(Equal(0))
@@ -78,7 +79,6 @@ var _ = Describe("Podman privileged container tests", func() {
})
It("podman cap-add CapEff", func() {
- SkipIfRootless()
// Get caps of current process
host_cap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
Expect(host_cap.ExitCode()).To(Equal(0))
@@ -106,7 +106,7 @@ var _ = Describe("Podman privileged container tests", func() {
})
It("podman privileged should inherit host devices", func() {
- SkipIfRootless()
+ SkipIfRootless() // FIXME: This seems to be broken for rootless mode, /dev/ is close to the same
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "ls", "-l", "/dev"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_restart_test.go b/test/e2e/run_restart_test.go
index 6150d63e5..1bef3f954 100644
--- a/test/e2e/run_restart_test.go
+++ b/test/e2e/run_restart_test.go
@@ -33,7 +33,7 @@ var _ = Describe("Podman run restart containers", func() {
})
It("Podman start after successful run", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.Podman([]string{"run", "--name", "test", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_security_labels.go b/test/e2e/run_security_labels.go
index e907607b5..7c8597866 100644
--- a/test/e2e/run_security_labels.go
+++ b/test/e2e/run_security_labels.go
@@ -127,7 +127,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman container runlabel (podman --version)", func() {
- SkipIfRemote()
+ SkipIfRemote("runlabel not supported on podman-remote")
PodmanDockerfile := `
FROM alpine:latest
LABEL io.containers.capabilities=chown,mknod`
diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go
index cef8a8d50..219750bcb 100644
--- a/test/e2e/run_selinux_test.go
+++ b/test/e2e/run_selinux_test.go
@@ -110,7 +110,6 @@ var _ = Describe("Podman run", func() {
})
It("podman test selinux label /run/secrets", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -143,7 +142,6 @@ var _ = Describe("Podman run", func() {
})
It("podman test selinux --privileged label /run/secrets", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go
index f62c52099..959c823b5 100644
--- a/test/e2e/run_staticip_test.go
+++ b/test/e2e/run_staticip_test.go
@@ -19,7 +19,7 @@ var _ = Describe("Podman run with --ip flag", func() {
)
BeforeEach(func() {
- SkipIfRootless()
+ SkipIfRootless() //rootless does not support --ip
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index cbfb6bf59..5617f50b7 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -11,7 +11,6 @@ import (
"syscall"
"time"
- "github.com/containers/podman/v2/pkg/cgroups"
. "github.com/containers/podman/v2/test/utils"
"github.com/containers/storage/pkg/stringid"
"github.com/mrunalp/fileutils"
@@ -50,7 +49,6 @@ var _ = Describe("Podman run", func() {
})
It("podman run a container based on a complex local image name", func() {
- SkipIfRootless()
imageName := strings.TrimPrefix(nginx, "quay.io/")
session := podmanTest.Podman([]string{"run", imageName, "ls"})
session.WaitWithDefaultTimeout()
@@ -59,7 +57,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run --signature-policy", func() {
- SkipIfRemote() // SigPolicy not handled by remote
+ SkipIfRemote("SigPolicy not handled by remote")
session := podmanTest.Podman([]string{"run", "--pull=always", "--signature-policy", "/no/such/file", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
@@ -295,7 +293,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run user capabilities test with image", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
dockerfile := `FROM busybox
USER bin`
podmanTest.BuildImage(dockerfile, "test", "false")
@@ -311,12 +309,15 @@ USER bin`
})
It("podman run limits test", func() {
- SkipIfRootless()
- session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "rtprio=99", "--cap-add=sys_nice", fedoraMinimal, "cat", "/proc/self/sched"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ SkipIfRootlessCgroupsV1()
+
+ if !isRootless() {
+ session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "rtprio=99", "--cap-add=sys_nice", fedoraMinimal, "cat", "/proc/self/sched"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ }
- session = podmanTest.Podman([]string{"run", "--rm", "--ulimit", "nofile=2048:2048", fedoraMinimal, "ulimit", "-n"})
+ session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "nofile=2048:2048", fedoraMinimal, "ulimit", "-n"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring("2048"))
@@ -326,10 +327,7 @@ USER bin`
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring("1024"))
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
- if !cgroupsv2 {
+ if !CGROUPSV2 {
// --oom-kill-disable not supported on cgroups v2.
session = podmanTest.Podman([]string{"run", "--rm", "--oom-kill-disable=true", fedoraMinimal, "echo", "memory-hog"})
session.WaitWithDefaultTimeout()
@@ -343,7 +341,7 @@ USER bin`
})
It("podman run limits host test", func() {
- SkipIfRemote()
+ SkipIfRemote("This can only be used for local tests")
var l syscall.Rlimit
@@ -370,25 +368,28 @@ USER bin`
})
It("podman run sysctl test", func() {
- SkipIfRootless()
+ SkipIfRootless() // Network sysclts are not avalable root rootless
session := podmanTest.Podman([]string{"run", "--rm", "--sysctl", "net.core.somaxconn=65535", ALPINE, "sysctl", "net.core.somaxconn"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring("net.core.somaxconn = 65535"))
+
+ // network sysctls should fail if --net=host is set
+ session = podmanTest.Podman([]string{"run", "--net", "host", "--rm", "--sysctl", "net.core.somaxconn=65535", ALPINE, "sysctl", "net.core.somaxconn"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
})
It("podman run blkio-weight test", func() {
- SkipIfRootless()
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
- if !cgroupsv2 {
+ SkipIfRootless() // FIXME: This is blowing up because of no /sys/fs/cgroup/user.slice/user-14467.slice/user@14467.service/cgroup.subtree_control file
+ // SkipIfRootlessCgroupsV1()
+ if !CGROUPSV2 {
if _, err := os.Stat("/sys/fs/cgroup/blkio/blkio.weight"); os.IsNotExist(err) {
Skip("Kernel does not support blkio.weight")
}
}
- if cgroupsv2 {
+ if CGROUPSV2 {
// convert linearly from [10-1000] to [1-10000]
session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.bfq.weight"})
session.WaitWithDefaultTimeout()
@@ -403,14 +404,11 @@ USER bin`
})
It("podman run device-read-bps test", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
+ SkipIfRootless() // FIXME: Missing /sys/fs/cgroup/user.slice/user-14467.slice/user@14467.service/cgroup.subtree_control
+ SkipIfRootlessCgroupsV1()
var session *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
session = podmanTest.Podman([]string{"run", "--rm", "--device-read-bps=/dev/zero:1mb", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"})
} else {
session = podmanTest.Podman([]string{"run", "--rm", "--device-read-bps=/dev/zero:1mb", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.read_bps_device"})
@@ -418,40 +416,34 @@ USER bin`
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- if !cgroupsv2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
+ if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
Expect(session.OutputToString()).To(ContainSubstring("1048576"))
}
})
It("podman run device-write-bps test", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
+ SkipIfRootless() // FIXME /sys/fs/cgroup/user.slice/user-14467.slice/user@14467.service/cgroup.subtree_control does not exist
+ SkipIfRootlessCgroupsV1()
var session *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
session = podmanTest.Podman([]string{"run", "--rm", "--device-write-bps=/dev/zero:1mb", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"})
} else {
session = podmanTest.Podman([]string{"run", "--rm", "--device-write-bps=/dev/zero:1mb", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.write_bps_device"})
}
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- if !cgroupsv2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
+ if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
Expect(session.OutputToString()).To(ContainSubstring("1048576"))
}
})
It("podman run device-read-iops test", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
+ SkipIfRootless() // FIXME /sys/fs/cgroup/user.slice/user-14467.slice/user@14467.service/cgroup.subtree_control does not exist
+ SkipIfRootlessCgroupsV1()
var session *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
session = podmanTest.Podman([]string{"run", "--rm", "--device-read-iops=/dev/zero:100", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"})
} else {
session = podmanTest.Podman([]string{"run", "--rm", "--device-read-iops=/dev/zero:100", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.read_iops_device"})
@@ -459,20 +451,17 @@ USER bin`
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- if !cgroupsv2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
+ if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
Expect(session.OutputToString()).To(ContainSubstring("100"))
}
})
It("podman run device-write-iops test", func() {
- SkipIfRootless()
-
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
+ SkipIfRootless() // FIXME /sys/fs/cgroup/user.slice/user-14467.slice/user@14467.service/cgroup.subtree_control does not exist
+ SkipIfRootlessCgroupsV1()
var session *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
session = podmanTest.Podman([]string{"run", "--rm", "--device-write-iops=/dev/zero:100", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"})
} else {
session = podmanTest.Podman([]string{"run", "--rm", "--device-write-iops=/dev/zero:100", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.write_iops_device"})
@@ -480,13 +469,13 @@ USER bin`
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- if !cgroupsv2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
+ if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
Expect(session.OutputToString()).To(ContainSubstring("100"))
}
})
It("podman run notify_socket", func() {
- SkipIfRemote()
+ SkipIfRemote("This can only be used for local tests")
host := GetHostDistributionInfo()
if host.Distribution != "rhel" && host.Distribution != "centos" && host.Distribution != "fedora" {
@@ -546,7 +535,7 @@ USER bin`
})
It("podman run with secrets", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
containersDir := filepath.Join(podmanTest.TempDir, "containers")
err := os.MkdirAll(containersDir, 0755)
Expect(err).To(BeNil())
@@ -586,7 +575,7 @@ USER bin`
})
It("podman run with FIPS mode secrets", func() {
- SkipIfRootless()
+ SkipIfRootless() // rootless can not manipulate system-fips file
fipsFile := "/etc/system-fips"
err = ioutil.WriteFile(fipsFile, []byte{}, 0755)
Expect(err).To(BeNil())
@@ -601,27 +590,24 @@ USER bin`
})
It("podman run without group-add", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(Equal("uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)"))
+ Expect(session.LineInOutputContains("27(video),777,65533(nogroup)")).To(BeFalse())
})
It("podman run with group-add", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--group-add=audio", "--group-add=nogroup", "--group-add=777", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(Equal("uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),18(audio),20(dialout),26(tape),27(video),777,65533(nogroup)"))
+ Expect(session.LineInOutputContains("777,65533(nogroup)")).To(BeTrue())
})
It("podman run with user (default)", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(Equal("uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)"))
+ Expect(session.LineInOutputContains("uid=0(root) gid=0(root)")).To(BeTrue())
})
It("podman run with user (integer, not in /etc/passwd)", func() {
@@ -632,19 +618,17 @@ USER bin`
})
It("podman run with user (integer, in /etc/passwd)", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--user=8", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(Equal("uid=8(mail) gid=12(mail) groups=12(mail)"))
+ Expect(session.LineInOutputContains("uid=8(mail) gid=12(mail)")).To(BeTrue())
})
It("podman run with user (username)", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--user=mail", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(Equal("uid=8(mail) gid=12(mail) groups=12(mail)"))
+ Expect(session.LineInOutputContains("uid=8(mail) gid=12(mail)")).To(BeTrue())
})
It("podman run with user:group (username:integer)", func() {
@@ -711,7 +695,7 @@ USER bin`
})
It("podman run with built-in volume image", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.Podman([]string{"run", "--rm", redis, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -733,23 +717,85 @@ USER mail`
err := os.MkdirAll(vol, 0755)
Expect(err).To(BeNil())
- volFile := filepath.Join(vol, "test.txt")
+ filename := "test.txt"
+ volFile := filepath.Join(vol, filename)
+ data := "Testing --volumes-from!!!"
+ err = ioutil.WriteFile(volFile, []byte(data), 0755)
+ Expect(err).To(BeNil())
+ mountpoint := "/myvol/"
+
+ session := podmanTest.Podman([]string{"create", "--volume", vol + ":" + mountpoint, ALPINE, "cat", mountpoint + filename})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ ctrID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "cat", mountpoint + filename})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal(data))
+
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "sh", "-c", "echo test >> " + mountpoint + filename})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"start", "--attach", ctrID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal(data + "test"))
+ })
+
+ It("podman run --volumes-from flag options", func() {
+ vol := filepath.Join(podmanTest.TempDir, "vol-test")
+ err := os.MkdirAll(vol, 0755)
+ Expect(err).To(BeNil())
+
+ filename := "test.txt"
+ volFile := filepath.Join(vol, filename)
data := "Testing --volumes-from!!!"
err = ioutil.WriteFile(volFile, []byte(data), 0755)
Expect(err).To(BeNil())
+ mountpoint := "/myvol/"
- session := podmanTest.Podman([]string{"create", "--volume", vol + ":/myvol", redis, "sh"})
+ session := podmanTest.Podman([]string{"create", "--volume", vol + ":" + mountpoint, ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
ctrID := session.OutputToString()
- session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "echo", "'testing read-write!' >> myvol/test.txt"})
+ // check that the read only option works
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":ro", ALPINE, "touch", mountpoint + "abc.txt"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(1))
+ Expect(session.ErrorToString()).To(ContainSubstring("Read-only file system"))
+
+ // check that both z and ro options work
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":ro,z", ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal(data))
+
+ // check that multiple ro/rw are not working
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":ro,rw", ALPINE, "cat", mountpoint + filename})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("cannot set ro or rw options more than once"))
- session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":z", ALPINE, "ls"})
+ // check that multiple z options are not working
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":z,z,ro", ALPINE, "cat", mountpoint + filename})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("cannot set :z more than once in mount options"))
+
+ // create new read only volume
+ session = podmanTest.Podman([]string{"create", "--volume", vol + ":" + mountpoint + ":ro", ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ ctrID = session.OutputToString()
+
+ // check if the original volume was mounted as read only that --volumes-from also mount it as read only
+ session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "touch", mountpoint + "abc.txt"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(1))
+ Expect(session.ErrorToString()).To(ContainSubstring("Read-only file system"))
})
It("podman run --volumes-from flag with built-in volumes", func() {
@@ -848,7 +894,7 @@ USER mail`
})
It("podman run --mount type=bind,bind-nonrecursive", func() {
- SkipIfRootless()
+ SkipIfRootless() // rootless users are not allowed to mount bind-nonrecursive (Could this be a Kernel bug?
session := podmanTest.Podman([]string{"run", "--mount", "type=bind,bind-nonrecursive,slave,src=/,target=/host", fedoraMinimal, "findmnt", "-nR", "/host"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -856,7 +902,6 @@ USER mail`
})
It("podman run --mount type=devpts,target=/foo/bar", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--mount", "type=devpts,target=/foo/bar", fedoraMinimal, "stat", "-f", "-c%T", "/foo/bar"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -966,7 +1011,7 @@ USER mail`
})
It("podman run with restart-policy always restarts containers", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
testDir := filepath.Join(podmanTest.RunRoot, "restart-test")
err := os.MkdirAll(testDir, 0755)
Expect(err).To(BeNil())
@@ -1009,8 +1054,8 @@ USER mail`
})
It("podman run with cgroups=disabled runs without cgroups", func() {
- SkipIfRemote()
- SkipIfRootless()
+ SkipIfRootless() // FIXME: I believe this should work but need to fix this test
+ SkipIfRootlessCgroupsV1()
// Only works on crun
if !strings.Contains(podmanTest.OCIRuntime, "crun") {
Skip("Test only works on crun")
@@ -1042,8 +1087,7 @@ USER mail`
})
It("podman run with cgroups=enabled makes cgroups", func() {
- SkipIfRemote()
- SkipIfRootless()
+ SkipIfRootlessCgroupsV1()
// Only works on crun
if !strings.Contains(podmanTest.OCIRuntime, "crun") {
Skip("Test only works on crun")
@@ -1086,7 +1130,7 @@ USER mail`
})
It("podman run --device-cgroup-rule", func() {
- SkipIfRootless()
+ SkipIfRootless() // rootless users are not allowed to mknod
deviceCgroupRule := "c 42:* rwm"
session := podmanTest.Podman([]string{"run", "--name", "test", "-d", "--device-cgroup-rule", deviceCgroupRule, ALPINE, "top"})
session.WaitWithDefaultTimeout()
@@ -1205,7 +1249,6 @@ USER mail`
It("podman run makes workdir from image", func() {
// BuildImage does not seem to work remote
- SkipIfRemote()
dockerfile := `FROM busybox
WORKDIR /madethis`
podmanTest.BuildImage(dockerfile, "test", "false")
@@ -1235,4 +1278,46 @@ WORKDIR /madethis`
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
+
+ It("podman run a container with --pull never should fail if no local store", func() {
+ // Make sure ALPINE image does not exist. Ignore errors
+ session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
+ session.WaitWithDefaultTimeout()
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "never", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ })
+
+ It("podman run container with --pull missing and only pull once", func() {
+ // Make sure ALPINE image does not exist. Ignore errors
+ session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
+ session.WaitWithDefaultTimeout()
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "missing", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "missing", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
+ })
+
+ It("podman run container with --pull missing should pull image multiple times", func() {
+ // Make sure ALPINE image does not exist. Ignore errors
+ session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
+ session.WaitWithDefaultTimeout()
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "always", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "always", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
+ })
})
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index c4ee05af9..fc9245e62 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -197,7 +197,7 @@ var _ = Describe("Podman run with volumes", func() {
})
It("podman run with volumes and suid/dev/exec options", func() {
- SkipIfRemote()
+ SkipIfRemote("podman-remote does not support --volumes")
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
os.Mkdir(mountPath, 0755)
@@ -227,8 +227,8 @@ var _ = Describe("Podman run with volumes", func() {
})
It("podman run with tmpfs named volume mounts and unmounts", func() {
- SkipIfRemote()
- SkipIfRootless()
+ SkipIfRootless() // FIXME: rootless podman mount requires you to be in a user namespace
+ SkipIfRemote("podman-remote does not support --volumes this test could be simplified to be tested on Remote.")
volName := "testvol"
mkVolume := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", "--opt", "device=tmpfs", "--opt", "o=nodev", "testvol"})
mkVolume.WaitWithDefaultTimeout()
@@ -315,7 +315,6 @@ var _ = Describe("Podman run with volumes", func() {
})
It("podman run with anonymous volume", func() {
- SkipIfRemote()
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list1.WaitWithDefaultTimeout()
Expect(list1.ExitCode()).To(Equal(0))
@@ -334,7 +333,6 @@ var _ = Describe("Podman run with volumes", func() {
})
It("podman rm -v removes anonymous volume", func() {
- SkipIfRemote()
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list1.WaitWithDefaultTimeout()
Expect(list1.ExitCode()).To(Equal(0))
@@ -436,7 +434,6 @@ var _ = Describe("Podman run with volumes", func() {
})
It("Podman mount over image volume with trailing /", func() {
- SkipIfRemote()
image := "podman-volume-test:trailing"
dockerfile := `
FROM alpine:latest
@@ -456,7 +453,7 @@ VOLUME /test/`
})
It("podman run with overlay volume flag", func() {
- SkipIfRemote()
+ SkipIfRemote("Overlay volumes only work locally")
if os.Getenv("container") != "" {
Skip("Overlay mounts not supported when running in a container")
}
diff --git a/test/e2e/run_working_dir.go b/test/e2e/run_working_dir.go
index 93330deba..85aa0cffe 100644
--- a/test/e2e/run_working_dir.go
+++ b/test/e2e/run_working_dir.go
@@ -50,7 +50,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run a container on an image with a workdir", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
dockerfile := `FROM alpine
RUN mkdir -p /home/foobar
WORKDIR /etc/foobar`
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go
index 0eb679fbf..81a746b86 100644
--- a/test/e2e/runlabel_test.go
+++ b/test/e2e/runlabel_test.go
@@ -29,8 +29,7 @@ var _ = Describe("podman container runlabel", func() {
)
BeforeEach(func() {
- // runlabel is not supported for remote connections
- SkipIfRemote()
+ SkipIfRemote("runlabel is not supported for remote connections")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index c6766fe2a..a3d56ad89 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -237,7 +237,7 @@ registries = ['{{.Host}}:{{.Port}}']`
})
It("podman search attempts HTTP if registry is in registries.insecure and force secure is false", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -278,7 +278,7 @@ registries = ['{{.Host}}:{{.Port}}']`
})
It("podman search doesn't attempt HTTP if force secure is true", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -317,7 +317,7 @@ registries = ['{{.Host}}:{{.Port}}']`
})
It("podman search doesn't attempt HTTP if registry is not listed as insecure", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -356,7 +356,7 @@ registries = ['{{.Host}}:{{.Port}}']`
})
It("podman search doesn't attempt HTTP if one registry is not listed as insecure", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -407,7 +407,6 @@ registries = ['{{.Host}}:{{.Port}}']`
// search should fail with nonexist authfile
It("podman search fail with nonexist --authfile", func() {
- SkipIfRemote()
search := podmanTest.Podman([]string{"search", "--authfile", "/tmp/nonexist", ALPINE})
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Not(Equal(0)))
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index aef5ca001..35b5cab6e 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -87,7 +87,6 @@ var _ = Describe("Podman start", func() {
})
It("podman start single container with attach and test the signal", func() {
- SkipIfRemote()
session := podmanTest.Podman([]string{"create", "--entrypoint", "sh", ALPINE, "-c", "exit 1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -132,14 +131,16 @@ var _ = Describe("Podman start", func() {
})
It("podman failed to start with --rm should delete the container", func() {
- Skip(v2remotefail)
session := podmanTest.Podman([]string{"create", "--name", "test1", "-it", "--rm", ALPINE, "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
start := podmanTest.Podman([]string{"start", "test1"})
start.WaitWithDefaultTimeout()
- Expect(start).To(ExitWithError())
+
+ wait := podmanTest.Podman([]string{"wait", "test1"})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait).To(ExitWithError())
Eventually(podmanTest.NumberOfContainers(), defaultWaitTimeout, 3.0).Should(BeZero())
})
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index ff6ddce7e..7ab435007 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -1,4 +1,4 @@
-// +build !remote
+// +build
package integration
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 22cd2e7ae..1437fd066 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -41,8 +41,6 @@ var _ = Describe("Podman stop", func() {
})
It("podman stop --ignore bogus container", func() {
- SkipIfRemote()
-
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -184,7 +182,7 @@ var _ = Describe("Podman stop", func() {
})
It("podman stop latest containers", func() {
- SkipIfRemote()
+ SkipIfRemote("--latest flag n/a")
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -198,14 +196,17 @@ var _ = Describe("Podman stop", func() {
})
It("podman stop all containers with one stopped", func() {
- Skip(v2remotefail)
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session2 := podmanTest.RunTopContainer("test2")
session2.WaitWithDefaultTimeout()
Expect(session2.ExitCode()).To(Equal(0))
- session3 := podmanTest.Podman([]string{"stop", "-l", "-t", "1"})
+ cid := "-l"
+ if IsRemote() {
+ cid = "test2"
+ }
+ session3 := podmanTest.Podman([]string{"stop", cid, "-t", "1"})
session3.WaitWithDefaultTimeout()
Expect(session3.ExitCode()).To(Equal(0))
session4 := podmanTest.Podman([]string{"stop", "-a", "-t", "1"})
@@ -288,7 +289,7 @@ var _ = Describe("Podman stop", func() {
})
It("podman stop invalid --latest and --cidfile and --all", func() {
- SkipIfRemote()
+ SkipIfRemote("--latest flag n/a")
result := podmanTest.Podman([]string{"stop", "--cidfile", "foobar", "--latest"})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go
index c184e1d01..aee5dafb8 100644
--- a/test/e2e/system_df_test.go
+++ b/test/e2e/system_df_test.go
@@ -35,7 +35,7 @@ var _ = Describe("podman system df", func() {
})
It("podman system df", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
session := podmanTest.Podman([]string{"create", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go
index 1c174e690..1a030216f 100644
--- a/test/e2e/system_reset_test.go
+++ b/test/e2e/system_reset_test.go
@@ -34,7 +34,7 @@ var _ = Describe("podman system reset", func() {
})
It("podman system reset", func() {
- SkipIfRemote()
+ SkipIfRemote("system reset not supported on podman --remote")
// system reset will not remove additional store images, so need to grab length
session := podmanTest.Podman([]string{"rmi", "--force", "--all"})
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 9a3247b77..8ef1e3ac7 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -20,7 +20,6 @@ var _ = Describe("Podman systemd", func() {
)
BeforeEach(func() {
- SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
@@ -48,6 +47,7 @@ WantedBy=multi-user.target
})
It("podman start container by systemd", func() {
+ SkipIfRootless() // rootless can not write to /etc
if os.Getenv("SKIP_USERNS") != "" {
Skip("Skip userns tests.")
}
diff --git a/test/e2e/unshare_test.go b/test/e2e/unshare_test.go
index a0c41b6f3..182a65775 100644
--- a/test/e2e/unshare_test.go
+++ b/test/e2e/unshare_test.go
@@ -15,7 +15,7 @@ var _ = Describe("Podman unshare", func() {
podmanTest *PodmanTestIntegration
)
BeforeEach(func() {
- SkipIfRemote()
+ SkipIfRemote("podman-remote unshare is not supported")
if _, err := os.Stat("/proc/self/uid_map"); err != nil {
Skip("User namespaces not supported.")
}
diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go
index 4e6dd6462..7766ce634 100644
--- a/test/e2e/untag_test.go
+++ b/test/e2e/untag_test.go
@@ -33,7 +33,7 @@ var _ = Describe("Podman untag", func() {
})
It("podman untag all", func() {
- SkipIfRemote()
+ SkipIfRemote("FIXME This should work on podman-remote")
setup := podmanTest.PodmanNoCache([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go
index 9ddbcc58f..695cccc11 100644
--- a/test/e2e/version_test.go
+++ b/test/e2e/version_test.go
@@ -37,21 +37,21 @@ var _ = Describe("Podman version", func() {
session := podmanTest.Podman([]string{"version"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(session.Out.Contents()).Should(ContainSubstring(version.Version))
+ Expect(session.Out.Contents()).Should(ContainSubstring(version.Version.String()))
})
It("podman -v", func() {
session := podmanTest.Podman([]string{"-v"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(session.Out.Contents()).Should(ContainSubstring(version.Version))
+ Expect(session.Out.Contents()).Should(ContainSubstring(version.Version.String()))
})
It("podman --version", func() {
session := podmanTest.Podman([]string{"--version"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(session.Out.Contents()).Should(ContainSubstring(version.Version))
+ Expect(session.Out.Contents()).Should(ContainSubstring(version.Version.String()))
})
It("podman version --format json", func() {
diff --git a/test/system/005-info.bats b/test/system/005-info.bats
index 3f1efd364..7452c1901 100644
--- a/test/system/005-info.bats
+++ b/test/system/005-info.bats
@@ -19,6 +19,8 @@ graphRoot:
graphStatus:
imageStore:\\\s\\\+number: 1
runRoot:
+cgroupManager: \\\(systemd\\\|cgroupfs\\\)
+cgroupVersion: v[12]
"
while read expect; do
is "$output" ".*$expect" "output includes '$expect'"
@@ -34,6 +36,8 @@ runRoot:
tests="
host.buildahVersion | [0-9.]
host.conmon.path | $expr_path
+host.cgroupManager | \\\(systemd\\\|cgroupfs\\\)
+host.cgroupVersion | v[12]
host.ociRuntime.path | $expr_path
store.configFile | $expr_path
store.graphDriverName | [a-z0-9]\\\+\\\$
diff --git a/test/system/010-images.bats b/test/system/010-images.bats
index c0a8936e3..ac65e54d9 100644
--- a/test/system/010-images.bats
+++ b/test/system/010-images.bats
@@ -112,4 +112,51 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z
run_podman rm mytinycontainer
}
+# Regression test for https://github.com/containers/podman/issues/7651
+# in which "podman pull image-with-sha" causes "images -a" to crash
+@test "podman images -a, after pulling by sha " {
+ # Get a baseline for 'images -a'
+ run_podman images -a
+ local images_baseline="$output"
+
+ # Get the digest of our local test image. We need to do this in two steps
+ # because 'podman inspect' only works reliably on *IMAGE ID*, not name.
+ # See https://github.com/containers/podman/issues/3761
+ run_podman inspect --format '{{.Id}}' $IMAGE
+ local iid="$output"
+ run_podman inspect --format '{{.Digest}}' $iid
+ local sha="$output"
+
+ local imgbase="${PODMAN_TEST_IMAGE_REGISTRY}/${PODMAN_TEST_IMAGE_USER}/${PODMAN_TEST_IMAGE_NAME}"
+ local fqin="${imgbase}@$sha"
+
+ # This will always pull, because even though it's the same image we
+ # already have, podman doesn't actually know that.
+ run_podman pull $fqin
+ is "$output" "Trying to pull ${fqin}\.\.\..*" "output of podman pull"
+
+ # Prior to #7654, this would crash and burn. Now podman recognizes it
+ # as the same image and, even though it internally tags it with the
+ # sha, still only shows us one image (which should be our baseline)
+ #
+ # WARNING! If this test fails, we're going to see a lot of failures
+ # in subsequent tests due to 'podman ps' showing the '@sha' tag!
+ # I choose not to add a complicated teardown() (with 'rmi @sha')
+ # because the failure window here is small, and if it fails it
+ # needs attention anyway. So if you see lots of failures, but
+ # start here because this is the first one, fix this problem.
+ # You can (probably) ignore any subsequent failures showing '@sha'
+ # in the error output.
+ run_podman images -a
+ is "$output" "$images_baseline" "images -a, after pull: same as before"
+
+ # Clean up: this should simply untag, not remove
+ run_podman rmi $fqin
+ is "$output" "Untagged: $fqin" "podman rmi untags, does not remove"
+
+ # ...and now we should still have our same image.
+ run_podman images -a
+ is "$output" "$images_baseline" "after podman rmi @sha, still the same"
+}
+
# vim: filetype=sh
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 518d902a7..b3599cc17 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -14,7 +14,7 @@ load helpers
# ...but check the configured runtime engine, and switch to crun as needed
run_podman info --format '{{ .Host.OCIRuntime.Path }}'
if expr "$output" : ".*/crun"; then
- err_no_such_cmd="Error: executable file not found in \$PATH: No such file or directory: OCI runtime command not found error"
+ err_no_such_cmd="Error: executable file.* not found in \$PATH: No such file or directory: OCI runtime command not found error"
err_no_exec_dir="Error: open executable: Operation not permitted: OCI runtime permission denied error"
fi
@@ -61,8 +61,8 @@ echo $rand | 0 | $rand
is "$tests_run" "$(grep . <<<$tests | wc -l)" "Ran the full set of tests"
}
-@test "podman run - globle runtime option" {
- skip_if_remote "runtime flag is not passing over remote"
+@test "podman run - global runtime option" {
+ skip_if_remote "runtime flag is not passed over remote"
run_podman 126 --runtime-flag invalidflag run --rm $IMAGE
is "$output" ".*invalidflag" "failed when passing undefined flags to the runtime"
}
@@ -132,8 +132,6 @@ echo $rand | 0 | $rand
}
@test "podman run --pull" {
- skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
-
run_podman run --pull=missing $IMAGE true
is "$output" "" "--pull=missing [present]: no output"
@@ -267,8 +265,6 @@ echo $rand | 0 | $rand
# symptom only manifests on a fedora container image -- we have no
# reproducer on alpine. Checking directory ownership is good enough.
@test "podman run : user namespace preserved root ownership" {
- skip_if_remote "FIXME: pending #7195"
-
for priv in "" "--privileged"; do
for user in "--user=0" "--user=100"; do
for keepid in "" "--userns=keep-id"; do
@@ -286,8 +282,6 @@ echo $rand | 0 | $rand
# #6829 : add username to /etc/passwd inside container if --userns=keep-id
@test "podman run : add username to /etc/passwd if --userns=keep-id" {
- skip_if_remote "FIXME: pending #7195"
-
# Default: always run as root
run_podman run --rm $IMAGE id -un
is "$output" "root" "id -un on regular container"
@@ -310,8 +304,6 @@ echo $rand | 0 | $rand
# #6991 : /etc/passwd is modifiable
@test "podman run : --userns=keep-id: passwd file is modifiable" {
- skip_if_remote "FIXME: pending #7195"
-
run_podman run -d --userns=keep-id $IMAGE sh -c 'while ! test -e /stop; do sleep 0.1; done'
cid="$output"
@@ -337,4 +329,68 @@ echo $rand | 0 | $rand
run_podman wait $cid
}
+# For #7754: json-file was equating to 'none'
+@test "podman run --log-driver" {
+ # '-' means that LogPath will be blank and there's no easy way to test
+ tests="
+none | -
+journald | -
+k8s-file | y
+json-file | f
+"
+ while read driver do_check; do
+ msg=$(random_string 15)
+ run_podman run --name myctr --log-driver $driver $IMAGE echo $msg
+
+ # Simple output check
+ # Special case: 'json-file' emits a warning, the rest do not
+ # ...but with podman-remote the warning is on the server only
+ if [[ $do_check == 'f' ]] && ! is_remote; then # 'f' for 'fallback'
+ is "${lines[0]}" ".* level=error msg=\"json-file logging specified but not supported. Choosing k8s-file logging instead\"" \
+ "Fallback warning emitted"
+ is "${lines[1]}" "$msg" "basic output sanity check (driver=$driver)"
+ else
+ is "$output" "$msg" "basic output sanity check (driver=$driver)"
+ fi
+
+ # Simply confirm that podman preserved our argument as-is
+ run_podman inspect --format '{{.HostConfig.LogConfig.Type}}' myctr
+ is "$output" "$driver" "podman inspect: driver"
+
+ # If LogPath is non-null, check that it exists and has a valid log
+ run_podman inspect --format '{{.LogPath}}' myctr
+ if [[ $do_check != '-' ]]; then
+ is "$output" "/.*" "LogPath (driver=$driver)"
+ if ! test -e "$output"; then
+ die "LogPath (driver=$driver) does not exist: $output"
+ fi
+ # eg 2020-09-23T13:34:58.644824420-06:00 stdout F 7aiYtvrqFGJWpak
+ is "$(< $output)" "[0-9T:.+-]\+ stdout F $msg" \
+ "LogPath contents (driver=$driver)"
+ else
+ is "$output" "" "LogPath (driver=$driver)"
+ fi
+ run_podman rm myctr
+ done < <(parse_table "$tests")
+
+ # Invalid log-driver argument
+ run_podman 125 run --log-driver=InvalidDriver $IMAGE true
+ is "$output" "Error: error running container create option: invalid log driver: invalid argument" \
+ "--log-driver InvalidDriver"
+}
+
+@test "podman run --log-driver journald" {
+ skip_if_remote "We cannot read journalctl over remote."
+
+ msg=$(random_string 20)
+ pidfile="${PODMAN_TMPDIR}/$(random_string 20)"
+
+ run_podman run --name myctr --log-driver journald --conmon-pidfile $pidfile $IMAGE echo $msg
+
+ journalctl --output cat _PID=$(cat $pidfile)
+ is "$output" "$msg" "check that journalctl output equals the container output"
+
+ run_podman rm myctr
+}
+
# vim: filetype=sh
diff --git a/test/system/060-mount.bats b/test/system/060-mount.bats
index d98a3eeb1..75c88e4ad 100644
--- a/test/system/060-mount.bats
+++ b/test/system/060-mount.bats
@@ -35,4 +35,34 @@ load helpers
fi
}
+
+@test "podman image mount" {
+ skip_if_remote "mounting remote is meaningless"
+ skip_if_rootless "too hard to test rootless"
+
+ # Start with clean slate
+ run_podman image umount -a
+
+ run_podman image mount $IMAGE
+ mount_path="$output"
+
+ test -d $mount_path
+
+ # Image is custom-built and has a file containing the YMD tag. Check it.
+ testimage_file="/home/podman/testimage-id"
+ test -e "$mount_path$testimage_file"
+ is $(< "$mount_path$testimage_file") "$PODMAN_TEST_IMAGE_TAG" \
+ "Contents of $testimage_file in image"
+
+ # 'image mount', no args, tells us what's mounted
+ run_podman image mount
+ is "$output" "$IMAGE $mount_path" "podman image mount with no args"
+
+ # Clean up
+ run_podman image umount $IMAGE
+
+ run_podman image mount
+ is "$output" "" "podman image mount, no args, after umount"
+}
+
# vim: filetype=sh
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index e3a139b4f..1329c6168 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -268,6 +268,14 @@ Labels.$label_name | $label_value
is "${lines[-1]}" "... ID: [0-9a-f]\{12\} Size: .* Top Layer of: \[localhost/build_test:latest]" \
"image tree: last layer line"
+ # FIXME: 'image tree --whatrequires' does not work via remote
+ if ! is_remote; then
+ run_podman image tree --whatrequires $IMAGE
+ is "${lines[-1]}" \
+ ".*ID: .* Top Layer of: \\[localhost/build_test:latest\\]" \
+ "'image tree --whatrequires' shows our built image"
+ fi
+
# Clean up
run_podman rmi -f build_test
}
diff --git a/test/system/080-pause.bats b/test/system/080-pause.bats
index 4ec0906f4..ea4c85f8f 100644
--- a/test/system/080-pause.bats
+++ b/test/system/080-pause.bats
@@ -6,7 +6,9 @@
load helpers
@test "podman pause/unpause" {
- skip_if_rootless "pause does not work rootless"
+ if is_rootless && ! is_cgroupsv2; then
+ skip "'podman pause' (rootless) only works with cgroups v2"
+ fi
cname=$(random_string 10)
run_podman run -d --name $cname $IMAGE \
diff --git a/test/system/120-load.bats b/test/system/120-load.bats
index d7aa16d95..8ea9b1c69 100644
--- a/test/system/120-load.bats
+++ b/test/system/120-load.bats
@@ -147,4 +147,45 @@ verify_iid_and_name() {
"Diagnostic from 'podman load' without redirection or -i"
}
+@test "podman load - multi-image archive" {
+ img1="quay.io/libpod/testimage:00000000"
+ img2="quay.io/libpod/testimage:20200902"
+ archive=$PODMAN_TMPDIR/myimage-$(random_string 8).tar
+
+ run_podman pull $img1
+ run_podman pull $img2
+
+ run_podman save -m -o $archive $img1 $img2
+ run_podman rmi -f $img1 $img2
+ run_podman load -i $archive
+
+ run_podman image exists $img1
+ run_podman image exists $img2
+ run_podman rmi -f $img1 $img2
+}
+
+@test "podman load - multi-image archive with redirect" {
+ img1="quay.io/libpod/testimage:00000000"
+ img2="quay.io/libpod/testimage:20200902"
+ archive=$PODMAN_TMPDIR/myimage-$(random_string 8).tar
+
+ run_podman pull $img1
+ run_podman pull $img2
+
+ # We can't use run_podman because that uses the BATS 'run' function
+ # which redirects stdout and stderr. Here we need to guarantee
+ # that podman's stdout is a pipe, not any other form of redirection
+ $PODMAN save -m $img1 $img2 | cat >$archive
+ if [ "$status" -ne 0 ]; then
+ die "Command failed: podman save ... | cat"
+ fi
+
+ run_podman rmi -f $img1 $img2
+ run_podman load -i $archive
+
+ run_podman image exists $img1
+ run_podman image exists $img2
+ run_podman rmi -f $img1 $img2
+}
+
# vim: filetype=sh
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index 3f50bd3c4..1c1e0f4ae 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -186,7 +186,6 @@ EOF
# Confirm that container sees the correct id
@test "podman volume with --userns=keep-id" {
is_rootless || skip "only meaningful when run rootless"
- skip_if_remote "FIXME: pending #7195"
myvoldir=${PODMAN_TMPDIR}/volume_$(random_string)
mkdir $myvoldir
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 7189d7e4b..2ae038dfe 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -173,6 +173,19 @@ function random_ip() {
# FIXME: --ip=$ip fails:
# Error adding network: failed to allocate all requested IPs
local mac_option="--mac-address=$mac"
+
+ # Create a custom image so we can test --infra-image and -command.
+ # It will have a randomly generated infra command, using the
+ # existing 'pause' script in our testimage. We assign a bogus
+ # entrypoint to confirm that --infra-command will override.
+ local infra_image="infra_$(random_string 10 | tr A-Z a-z)"
+ local infra_command="/pause_$(random_string 10)"
+ run_podman build -t $infra_image - << EOF
+FROM $IMAGE
+RUN ln /home/podman/pause $infra_command
+ENTRYPOINT ["/original-entrypoint-should-be-overridden"]
+EOF
+
if is_rootless; then
mac_option=
fi
@@ -185,12 +198,21 @@ function random_ip() {
--dns-search "$dns_search" \
--dns-opt "$dns_opt" \
--publish "$port_out:$port_in" \
- --label "${labelname}=${labelvalue}"
+ --label "${labelname}=${labelvalue}" \
+ --infra-image "$infra_image" \
+ --infra-command "$infra_command"
pod_id="$output"
# Check --pod-id-file
is "$(<$pod_id_file)" "$pod_id" "contents of pod-id-file"
+ # Get ID of infra container
+ run_podman pod inspect --format '{{(index .Containers 0).ID}}' mypod
+ local infra_cid="$output"
+ # confirm that entrypoint is what we set
+ run_podman container inspect --format '{{.Config.Entrypoint}}' $infra_cid
+ is "$output" "$infra_command" "infra-command took effect"
+
# Check each of the options
if [ -n "$mac_option" ]; then
run_podman run --rm --pod mypod $IMAGE ip link show
@@ -249,9 +271,16 @@ function random_ip() {
run_podman logs $cid
is "$output" "$teststring" "test string received on container"
+ # Finally, confirm the infra-container and -command. We run this late,
+ # not at pod creation, to give the infra container time to start & log.
+ run_podman logs $infra_cid
+ is "$output" "Confirmed: testimage pause invoked as $infra_command" \
+ "pod ran with our desired infra container + command"
+
# Clean up
run_podman rm $cid
run_podman pod rm -f mypod
+ run_podman rmi $infra_image
}
# vim: filetype=sh
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index 39de8ad54..d2454fbf4 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -80,4 +80,33 @@ load helpers
run_podman rm $cid
}
+# "network create" now works rootless, with the help of a special container
+@test "podman network create" {
+ local mynetname=testnet-$(random_string 10)
+ local mysubnet=$(random_rfc1918_subnet)
+
+ run_podman network create --subnet "${mysubnet}.0/24" $mynetname
+ is "$output" ".*/cni/net.d/$mynetname.conflist" "output of 'network create'"
+
+ # WARNING: this pulls a ~100MB image from quay.io, hence is slow/flaky
+ run_podman run --rm --network $mynetname $IMAGE ip a
+ is "$output" ".* inet ${mysubnet}\.2/24 brd ${mysubnet}\.255 " \
+ "sdfsdf"
+
+ # Cannot create network with the same name
+ run_podman 125 network create $mynetname
+ is "$output" "Error: the network name $mynetname is already used" \
+ "Trying to create an already-existing network"
+
+ run_podman network rm $mynetname
+ run_podman 125 network rm $mynetname
+
+ # rootless CNI leaves behind an image pulled by SHA, hence with no tag.
+ # Remove it if present; we can only remove it by ID.
+ run_podman images --format '{{.Id}}' rootless-cni-infra
+ if [ -n "$output" ]; then
+ run_podman rmi $output
+ fi
+}
+
# vim: filetype=sh
diff --git a/test/system/build-testimage b/test/system/build-testimage
index 64aa46337..ef14d3afd 100755
--- a/test/system/build-testimage
+++ b/test/system/build-testimage
@@ -26,23 +26,51 @@ create_time_z=$(env TZ=UTC date +'%Y-%m-%dT%H:%M:%SZ')
set -ex
+# We'll need to create a Containerfile plus various other files to add in
+#
# Please document the reason for all flags, apk's, and anything non-obvious
+tmpdir=$(mktemp -t -d $(basename $0).tmp.XXXXXXX)
+cd $tmpdir
+
+# 'image mount' test will confirm that this file exists and has our YMD tag
+echo $YMD >testimage-id
+
+# 'pod' test will use this for --infra-command
+cat >pause <<EOF
+#!/bin/sh
#
-# --squash-all : needed by 'tree' test in 070-build.bats
-# busybox-extras : provides httpd needed in 500-networking.bats
+# Trivial little pause script, used in one of the pod tests
#
-podman rmi -f testimage &> /dev/null || true
-podman build --squash-all -t testimage - <<EOF
+echo Confirmed: testimage pause invoked as \$0
+while :; do
+ sleep 0.1
+done
+EOF
+chmod 755 pause
+
+# alpine because it's small and light and reliable
+# busybox-extras provides httpd needed in 500-networking.bats
+cat >Containerfile <<EOF
FROM docker.io/library/alpine:3.12.0
RUN apk add busybox-extras
+ADD testimage-id pause /home/podman/
LABEL created_by=$create_script
LABEL created_at=$create_time_z
+WORKDIR /home/podman
CMD ["/bin/echo", "This container is intended for podman CI testing"]
EOF
+# --squash-all : needed by 'tree' test in 070-build.bats
+podman rmi -f testimage &> /dev/null || true
+podman build --squash-all -t testimage .
+
+# Clean up
+cd /tmp
+rm -rf $tmpdir
+
# Tag and push to quay.
-podman tag testimage quay.io/edsantiago/testimage:$YMD
-podman push quay.io/edsantiago/testimage:$YMD
+podman tag testimage quay.io/libpod/testimage:$YMD
+podman push quay.io/libpod/testimage:$YMD
# Side note: there should always be a testimage tagged ':00000000'
# (eight zeroes) in the same location; this is used by tests which
@@ -54,6 +82,6 @@ podman push quay.io/edsantiago/testimage:$YMD
#
# podman pull docker.io/library/busybox:1.32.0
# podman tag docker.io/library/busybox:1.32.0 \
-# quay.io/edsantiago/testimage:00000000
-# podman push quay.io/edsantiago/testimage:00000000
+# quay.io/libpod/testimage:00000000
+# podman push quay.io/libpod/testimage:00000000
#
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 514ba249e..eb3e4c7ec 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -7,7 +7,7 @@ PODMAN=${PODMAN:-podman}
PODMAN_TEST_IMAGE_REGISTRY=${PODMAN_TEST_IMAGE_REGISTRY:-"quay.io"}
PODMAN_TEST_IMAGE_USER=${PODMAN_TEST_IMAGE_USER:-"libpod"}
PODMAN_TEST_IMAGE_NAME=${PODMAN_TEST_IMAGE_NAME:-"testimage"}
-PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20200902"}
+PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20200917"}
PODMAN_TEST_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG"
# Because who wants to spell that out each time?
@@ -240,6 +240,16 @@ function is_remote() {
[[ "$PODMAN" =~ -remote ]]
}
+function is_cgroupsv1() {
+ # WARNING: This will break if there's ever a cgroups v3
+ ! is_cgroupsv2
+}
+
+function is_cgroupsv2() {
+ cgroup_type=$(stat -f -c %T /sys/fs/cgroup)
+ test "$cgroup_type" = "cgroupfs"
+}
+
###########################
# _add_label_if_missing # make sure skip messages include rootless/remote
###########################
@@ -376,7 +386,12 @@ function parse_table() {
while read col; do
dprint "col=<<$col>>"
row+=("$col")
- done < <(echo "$line" | tr '|' '\012' | sed -e 's/^ *//' -e 's/\\/\\\\/g')
+ done < <(echo "$line" | sed -E -e 's/(^|\s)\|(\s|$)/\n /g' | sed -e 's/^ *//' -e 's/\\/\\\\/g')
+ # the above seds:
+ # 1) Convert '|' to newline, but only if bracketed by spaces or
+ # at beginning/end of line (this allows 'foo|bar' in tests);
+ # 2) then remove leading whitespace;
+ # 3) then double-escape all backslashes
printf "%q " "${row[@]}"
printf "\n"
@@ -397,6 +412,35 @@ function random_string() {
}
+###########################
+# random_rfc1918_subnet #
+###########################
+#
+# Use the class B set, because much of our CI environment (Google, RH)
+# already uses up much of the class A, and it's really hard to test
+# if a block is in use.
+#
+# This returns THREE OCTETS! It is up to our caller to append .0/24, .255, &c.
+#
+function random_rfc1918_subnet() {
+ local retries=1024
+
+ while [ "$retries" -gt 0 ];do
+ local cidr=172.$(( 16 + $RANDOM % 16 )).$(( $RANDOM & 255 ))
+
+ in_use=$(ip route list | fgrep $cidr)
+ if [ -z "$in_use" ]; then
+ echo "$cidr"
+ return
+ fi
+
+ retries=$(( retries - 1 ))
+ done
+
+ die "Could not find a random not-in-use rfc1918 subnet"
+}
+
+
#########################
# find_exec_pid_files # Returns nothing or exec_pid hash files
#########################
diff --git a/test/system/helpers.t b/test/system/helpers.t
index 7a331174b..190e8ba35 100755
--- a/test/system/helpers.t
+++ b/test/system/helpers.t
@@ -85,7 +85,7 @@ while read x y z; do
check_result "$x" "''" "empty string - left-hand"
check_result "$y" "''" "empty string - middle"
check_result "$z" "''" "empty string - right"
-done < <(parse_table " | |")
+done < <(parse_table " | |")
# Quotes
while read x y z;do
@@ -108,6 +108,13 @@ while read x y z;do
check_result "$3" "g" "double quotes - token split - 3"
done < <(parse_table "a 'b c' | d \"e f\" g | h")
+# Split on '|' only when bracketed by spaces or at beginning/end of line
+while read x y z;do
+ check_result "$x" "|x" "pipe in strings - pipe at start"
+ check_result "$y" "y|y1" "pipe in strings - pipe in middle"
+ check_result "$z" "z|" "pipe in strings - pipe at end"
+done < <(parse_table "|x | y|y1 | z|")
+
# END test the parse_table helper
###############################################################################
# BEGIN dprint