summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/10-images.at9
-rw-r--r--test/apiv2/12-imagesMore.at18
-rw-r--r--test/apiv2/20-containers.at2
-rw-r--r--test/apiv2/35-networks.at6
-rw-r--r--test/apiv2/rest_api/test_rest_v2_0_0.py8
-rw-r--r--test/e2e/attach_test.go2
-rw-r--r--test/e2e/build_test.go29
-rw-r--r--test/e2e/checkpoint_test.go4
-rw-r--r--test/e2e/commit_test.go2
-rw-r--r--test/e2e/common_test.go28
-rw-r--r--test/e2e/config/containers.conf3
-rw-r--r--test/e2e/container_inspect_test.go4
-rw-r--r--test/e2e/containers_conf_test.go35
-rw-r--r--test/e2e/cp_test.go2
-rw-r--r--test/e2e/create_staticip_test.go4
-rw-r--r--test/e2e/create_staticmac_test.go4
-rw-r--r--test/e2e/create_test.go14
-rw-r--r--test/e2e/diff_test.go2
-rw-r--r--test/e2e/events_test.go2
-rw-r--r--test/e2e/exec_test.go2
-rw-r--r--test/e2e/exists_test.go2
-rw-r--r--test/e2e/export_test.go2
-rw-r--r--test/e2e/generate_kube_test.go2
-rw-r--r--test/e2e/generate_systemd_test.go61
-rw-r--r--test/e2e/healthcheck_run_test.go2
-rw-r--r--test/e2e/history_test.go2
-rw-r--r--test/e2e/image_sign_test.go2
-rw-r--r--test/e2e/images_test.go6
-rw-r--r--test/e2e/import_test.go2
-rw-r--r--test/e2e/info_test.go2
-rw-r--r--test/e2e/init_test.go2
-rw-r--r--test/e2e/inspect_test.go44
-rw-r--r--test/e2e/kill_test.go15
-rw-r--r--test/e2e/libpod_suite_remote_test.go2
-rw-r--r--test/e2e/load_test.go2
-rw-r--r--test/e2e/login_logout_test.go2
-rw-r--r--test/e2e/logs_test.go624
-rw-r--r--test/e2e/manifest_test.go2
-rw-r--r--test/e2e/mount_rootless_test.go2
-rw-r--r--test/e2e/mount_test.go2
-rw-r--r--test/e2e/namespace_test.go2
-rw-r--r--test/e2e/negative_test.go2
-rw-r--r--test/e2e/network_connect_disconnect_test.go125
-rw-r--r--test/e2e/network_create_test.go4
-rw-r--r--test/e2e/network_test.go34
-rw-r--r--test/e2e/pause_test.go2
-rw-r--r--test/e2e/play_kube_test.go2
-rw-r--r--test/e2e/pod_create_test.go18
-rw-r--r--test/e2e/pod_infra_container_test.go2
-rw-r--r--test/e2e/pod_inspect_test.go4
-rw-r--r--test/e2e/pod_kill_test.go2
-rw-r--r--test/e2e/pod_pause_test.go2
-rw-r--r--test/e2e/pod_pod_namespaces_test.go2
-rw-r--r--test/e2e/pod_prune_test.go2
-rw-r--r--test/e2e/pod_ps_test.go2
-rw-r--r--test/e2e/pod_restart_test.go2
-rw-r--r--test/e2e/pod_rm_test.go2
-rw-r--r--test/e2e/pod_start_test.go2
-rw-r--r--test/e2e/pod_stats_test.go2
-rw-r--r--test/e2e/pod_stop_test.go2
-rw-r--r--test/e2e/pod_top_test.go2
-rw-r--r--test/e2e/port_test.go2
-rw-r--r--test/e2e/prune_test.go3
-rw-r--r--test/e2e/ps_test.go34
-rw-r--r--test/e2e/pull_test.go2
-rw-r--r--test/e2e/push_test.go4
-rw-r--r--test/e2e/rename_test.go2
-rw-r--r--test/e2e/restart_test.go2
-rw-r--r--test/e2e/rm_test.go2
-rw-r--r--test/e2e/rmi_test.go2
-rw-r--r--test/e2e/run_apparmor_test.go2
-rw-r--r--test/e2e/run_cgroup_parent_test.go2
-rw-r--r--test/e2e/run_cleanup_test.go2
-rw-r--r--test/e2e/run_cpu_test.go2
-rw-r--r--test/e2e/run_device_test.go2
-rw-r--r--test/e2e/run_dns_test.go2
-rw-r--r--test/e2e/run_entrypoint_test.go14
-rw-r--r--test/e2e/run_env_test.go2
-rw-r--r--test/e2e/run_exit_test.go4
-rw-r--r--test/e2e/run_memory_test.go26
-rw-r--r--test/e2e/run_networking_test.go16
-rw-r--r--test/e2e/run_ns_test.go2
-rw-r--r--test/e2e/run_passwd_test.go2
-rw-r--r--test/e2e/run_privileged_test.go2
-rw-r--r--test/e2e/run_restart_test.go2
-rw-r--r--test/e2e/run_seccomp_test.go2
-rw-r--r--test/e2e/run_security_labels_test.go2
-rw-r--r--test/e2e/run_selinux_test.go2
-rw-r--r--test/e2e/run_signal_test.go4
-rw-r--r--test/e2e/run_staticip_test.go2
-rw-r--r--test/e2e/run_test.go63
-rw-r--r--test/e2e/run_userns_test.go2
-rw-r--r--test/e2e/run_volume_test.go99
-rw-r--r--test/e2e/run_working_dir_test.go8
-rw-r--r--test/e2e/runlabel_test.go2
-rw-r--r--test/e2e/save_test.go4
-rw-r--r--test/e2e/search_test.go2
-rw-r--r--test/e2e/secret_test.go2
-rw-r--r--test/e2e/start_test.go19
-rw-r--r--test/e2e/stats_test.go2
-rw-r--r--test/e2e/stop_test.go8
-rw-r--r--test/e2e/system_connection_test.go2
-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/tag_test.go2
-rw-r--r--test/e2e/toolbox_test.go4
-rw-r--r--test/e2e/top_test.go2
-rw-r--r--test/e2e/tree_test.go2
-rw-r--r--test/e2e/trust_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.go4
-rw-r--r--test/e2e/volume_create_test.go2
-rw-r--r--test/e2e/volume_exists_test.go2
-rw-r--r--test/e2e/volume_inspect_test.go2
-rw-r--r--test/e2e/volume_ls_test.go2
-rw-r--r--test/e2e/volume_plugin_test.go2
-rw-r--r--test/e2e/volume_prune_test.go2
-rw-r--r--test/e2e/volume_rm_test.go2
-rw-r--r--test/e2e/wait_test.go2
-rw-r--r--test/python/docker/test_containers.py7
-rw-r--r--test/system/030-run.bats10
-rw-r--r--test/system/055-rm.bats7
-rw-r--r--test/system/065-cp.bats38
-rw-r--r--test/system/070-build.bats68
-rw-r--r--test/system/600-completion.bats22
-rw-r--r--test/system/700-play.bats (renamed from test/e2e/test.yaml)29
-rwxr-xr-xtest/system/build-testimage52
-rw-r--r--test/system/helpers.bash9
-rw-r--r--test/upgrade/README.md87
-rw-r--r--test/upgrade/helpers.bash11
-rw-r--r--test/upgrade/test-upgrade.bats313
-rw-r--r--test/utils/common_function_test.go2
-rw-r--r--test/utils/podmansession_test.go2
-rw-r--r--test/utils/podmantest_test.go2
-rw-r--r--test/utils/utils.go10
-rw-r--r--test/utils/utils_suite_test.go2
138 files changed, 1744 insertions, 506 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at
index 7b500bf57..f866422e2 100644
--- a/test/apiv2/10-images.at
+++ b/test/apiv2/10-images.at
@@ -41,10 +41,17 @@ t GET images/$iid/json 200 \
.Id=sha256:$iid \
.RepoTags[0]=$IMAGE
-t POST "images/create?fromImage=alpine" '' 200
+t POST "images/create?fromImage=alpine" '' 200 .error~null .status~".*Download complete.*"
t POST "images/create?fromImage=alpine&tag=latest" '' 200
+# Make sure that new images are pulled
+old_iid=$(podman image inspect --format "{{.ID}}" docker.io/library/alpine:latest)
+podman rmi -f docker.io/library/alpine:latest
+podman tag $IMAGE docker.io/library/alpine:latest
+t POST "images/create?fromImage=alpine" '' 200 .error~null .status~".*$old_iid.*"
+podman untag $IMAGE docker.io/library/alpine:latest
+
t POST "images/create?fromImage=quay.io/libpod/alpine&tag=sha256:fa93b01658e3a5a1686dc3ae55f170d8de487006fb53a28efcd12ab0710a2e5f" '' 200
# Display the image history
diff --git a/test/apiv2/12-imagesMore.at b/test/apiv2/12-imagesMore.at
index fe6a271ce..4f3ddf925 100644
--- a/test/apiv2/12-imagesMore.at
+++ b/test/apiv2/12-imagesMore.at
@@ -3,6 +3,9 @@
# Tests for more image-related endpoints
#
+red='\e[31m'
+nc='\e[0m'
+
podman pull -q $IMAGE
t GET libpod/images/json 200 \
@@ -26,6 +29,17 @@ t GET libpod/images/$IMAGE/json 200 \
podman run -d --name registry -p 5000:5000 quay.io/libpod/registry:2.6 /entrypoint.sh /etc/docker/registry/config.yml
wait_for_port localhost 5000
+# Push to local registry and check output
+while read -r LINE
+do
+ if echo "${LINE}" | jq --exit-status 'select( .status != null) | select ( .status | contains("digest: sha256:"))' &>/dev/null; then
+ GOT_DIGEST="1"
+ fi
+done < <(curl -sL "http://$HOST:$PORT/images/localhost:5000/myrepo/push?tlsVerify=false&tag=mytag" -XPOST)
+if [ -z "${GOT_DIGEST}" ] ; then
+ echo -e "${red}not ok: did not found digest in output${nc}" 1>&2;
+fi
+
# Push to local registry
t POST "images/localhost:5000/myrepo/push?tlsVerify=false&tag=mytag" '' 200
@@ -43,3 +57,7 @@ t DELETE libpod/images/$IMAGE 200 \
.ExitCode=0
t DELETE libpod/images/quay.io/libpod/registry:2.6 200 \
.ExitCode=0
+
+if [ -z "${GOT_DIGEST}" ] ; then
+ exit 1;
+fi
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 0da196e46..a99e9a184 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -63,7 +63,7 @@ cid=$(jq -r '.Id' <<<"$output")
# Prior to the fix in #6835, this would fail 500 "args must not be empty"
t POST libpod/containers/${cid}/start '' 204
# Container should exit almost immediately. Wait for it, confirm successful run
-t POST libpod/containers/${cid}/wait '' 200 '0'
+t POST "libpod/containers/${cid}/wait?condition=stopped&condition=exited" '' 200 '0'
t GET libpod/containers/${cid}/json 200 \
.Id=$cid \
.State.Status~\\\(exited\\\|stopped\\\) \
diff --git a/test/apiv2/35-networks.at b/test/apiv2/35-networks.at
index 5327bd076..25a292cc5 100644
--- a/test/apiv2/35-networks.at
+++ b/test/apiv2/35-networks.at
@@ -38,6 +38,9 @@ length=2
# filters={"label":["abc"]}
t GET networks?filters=%7B%22label%22%3A%5B%22abc%22%5D%7D 200 \
length=1
+# filters={"label":{"abc":true}} old docker filter type see #9526
+t GET networks?filters=%7B%22label%22%3A%7B%22abc%22%3Atrue%7D%7D 200 \
+length=1
# id filter filters={"id":["a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1"]}
t GET networks?filters=%7B%22id%22%3A%5B%22a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1%22%5D%7D 200 \
length=1 \
@@ -46,6 +49,9 @@ length=1 \
# invalid filter filters={"dangling":["1"]}
t GET networks?filters=%7B%22dangling%22%3A%5B%221%22%5D%7D 500 \
.cause='invalid filter "dangling"'
+# (#9293 with no networks the endpoint should return empty array instead of null)
+t GET networks?filters=%7B%22name%22%3A%5B%22doesnotexists%22%5D%7D 200 \
+"[]"
# network inspect docker
t GET networks/a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 200 \
diff --git a/test/apiv2/rest_api/test_rest_v2_0_0.py b/test/apiv2/rest_api/test_rest_v2_0_0.py
index 73db35cc1..05c24f2ea 100644
--- a/test/apiv2/rest_api/test_rest_v2_0_0.py
+++ b/test/apiv2/rest_api/test_rest_v2_0_0.py
@@ -483,8 +483,16 @@ class TestApi(unittest.TestCase):
inspect = requests.get(PODMAN_URL + f"/v1.40/networks/{ident}")
self.assertEqual(inspect.status_code, 404, inspect.content)
+ # network prune
+ prune_name = "Network_" + "".join(random.choice(string.ascii_letters) for i in range(10))
+ prune_create = requests.post(PODMAN_URL + "/v1.40/networks/create", json={"Name": prune_name})
+ self.assertEqual(create.status_code, 201, prune_create.content)
+
prune = requests.post(PODMAN_URL + "/v1.40/networks/prune")
self.assertEqual(prune.status_code, 200, prune.content)
+ obj = json.loads(prune.content)
+ self.assertTrue(prune_name in obj["NetworksDeleted"])
+
def test_volumes_compat(self):
name = "Volume_" + "".join(random.choice(string.ascii_letters) for i in range(10))
diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go
index 0c27e05c7..146ff27a5 100644
--- a/test/e2e/attach_test.go
+++ b/test/e2e/attach_test.go
@@ -5,7 +5,7 @@ import (
"syscall"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 9bab4c926..c733db61c 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -8,7 +8,7 @@ import (
"strings"
"github.com/containers/buildah"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -489,7 +489,7 @@ RUN grep CapEff /proc/self/status`
To(ContainElement("0000000000000400"))
})
- It("podman build --arch", func() {
+ It("podman build --isolation && --arch", func() {
targetPath, err := CreateTempDirInTempDir()
Expect(err).To(BeNil())
@@ -502,11 +502,34 @@ RUN grep CapEff /proc/self/status`
// When
session := podmanTest.Podman([]string{
- "build", "--arch", "arm64", targetPath,
+ "build", "--isolation", "oci", "--arch", "arm64", targetPath,
})
session.WaitWithDefaultTimeout()
+ // Then
+ Expect(session.ExitCode()).To(Equal(0))
+ // When
+ session = podmanTest.Podman([]string{
+ "build", "--isolation", "chroot", "--arch", "arm64", targetPath,
+ })
+ session.WaitWithDefaultTimeout()
// Then
Expect(session.ExitCode()).To(Equal(0))
+
+ // When
+ session = podmanTest.Podman([]string{
+ "build", "--isolation", "rootless", "--arch", "arm64", targetPath,
+ })
+ session.WaitWithDefaultTimeout()
+ // Then
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // When
+ session = podmanTest.Podman([]string{
+ "build", "--isolation", "bogus", "--arch", "arm64", targetPath,
+ })
+ session.WaitWithDefaultTimeout()
+ // Then
+ Expect(session.ExitCode()).To(Equal(125))
})
})
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 3270ce685..9d0049910 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -6,8 +6,8 @@ import (
"os/exec"
"strings"
- "github.com/containers/podman/v2/pkg/criu"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/criu"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index 8760978fd..0d3f2bed7 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -5,7 +5,7 @@ import (
"os"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 53810d882..70ffdebea 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -15,11 +15,11 @@ import (
"testing"
"time"
- "github.com/containers/podman/v2/libpod/define"
- "github.com/containers/podman/v2/pkg/cgroups"
- "github.com/containers/podman/v2/pkg/inspect"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/pkg/cgroups"
+ "github.com/containers/podman/v3/pkg/inspect"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage"
"github.com/containers/storage/pkg/reexec"
"github.com/containers/storage/pkg/stringid"
@@ -436,13 +436,20 @@ func (p *PodmanTestIntegration) RunLsContainerInPod(name, pod string) (*PodmanSe
// BuildImage uses podman build and buildah to build an image
// called imageName based on a string dockerfile
-func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) {
+func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) string {
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile")
err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
Expect(err).To(BeNil())
- session := p.Podman([]string{"build", "--layers=" + layers, "-t", imageName, "--file", dockerfilePath, p.TempDir})
+ cmd := []string{"build", "--layers=" + layers, "--file", dockerfilePath}
+ if len(imageName) > 0 {
+ cmd = append(cmd, []string{"-t", imageName}...)
+ }
+ cmd = append(cmd, p.TempDir)
+ session := p.Podman(cmd)
session.Wait(240)
Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString()))
+ output := session.OutputToStringArray()
+ return output[len(output)-1]
}
// PodmanPID execs podman and returns its PID
@@ -619,6 +626,13 @@ func SkipIfNotRootless(reason string) {
}
}
+func SkipIfNotSystemd(manager, reason string) {
+ checkReason(reason)
+ if manager != "systemd" {
+ ginkgo.Skip("[notSystemd]: " + reason)
+ }
+}
+
func SkipIfNotFedora() {
info := GetHostDistributionInfo()
if info.Distribution != "fedora" {
diff --git a/test/e2e/config/containers.conf b/test/e2e/config/containers.conf
index 5a5e4b7a5..bbd712254 100644
--- a/test/e2e/config/containers.conf
+++ b/test/e2e/config/containers.conf
@@ -53,6 +53,9 @@ tz = "Pacific/Honolulu"
umask = "0002"
+annotations=["run.oci.keep_original_groups=1",]
+
+no_hosts=true
[engine]
network_cmd_options=["allow_host_loopback=true"]
diff --git a/test/e2e/container_inspect_test.go b/test/e2e/container_inspect_test.go
index e84fd9f2e..840f13e3d 100644
--- a/test/e2e/container_inspect_test.go
+++ b/test/e2e/container_inspect_test.go
@@ -3,8 +3,8 @@ package integration
import (
"os"
- "github.com/containers/podman/v2/pkg/annotations"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/annotations"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 719ac9fac..6b1a0d16e 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -8,7 +8,7 @@ import (
"path/filepath"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -320,4 +320,37 @@ var _ = Describe("Podman run", func() {
Expect(session.OutputToString()).To(Equal("0022"))
})
+ It("podman run containers.conf annotations test", func() {
+ //containers.conf is set to "run.oci.keep_original_groups=1"
+ session := podmanTest.Podman([]string{"create", "--rm", "--name", "test", fedoraMinimal})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", "--format", "{{ .Config.Annotations }}", "test"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.OutputToString()).To(ContainSubstring("run.oci.keep_original_groups:1"))
+ })
+
+ It("podman run with --add-host and no-hosts=true fails", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--add-host", "test1:127.0.0.1", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
+ Expect(session.ErrorToString()).To(ContainSubstring("--no-hosts and --add-host cannot be set together"))
+
+ session = podmanTest.Podman([]string{"run", "-dt", "--add-host", "test1:127.0.0.1", "--no-hosts=false", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman run with no-hosts=true /etc/hosts does not include hostname", func() {
+ session := podmanTest.Podman([]string{"run", "--rm", "--name", "test", ALPINE, "cat", "/etc/hosts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Not(ContainSubstring("test")))
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--name", "test", "--no-hosts=false", ALPINE, "cat", "/etc/hosts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("test"))
+ })
})
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index f81323847..c0fb3f887 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -7,7 +7,7 @@ import (
"os/user"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go
index 698bbf976..340ea31f3 100644
--- a/test/e2e/create_staticip_test.go
+++ b/test/e2e/create_staticip_test.go
@@ -4,8 +4,8 @@ import (
"os"
"time"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/create_staticmac_test.go b/test/e2e/create_staticmac_test.go
index 4c8f371a4..1df93553d 100644
--- a/test/e2e/create_staticmac_test.go
+++ b/test/e2e/create_staticmac_test.go
@@ -3,8 +3,8 @@ package integration
import (
"os"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 67c08ac09..1f1786dbe 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -8,7 +8,8 @@ import (
"runtime"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
+ "github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -576,15 +577,20 @@ var _ = Describe("Podman create", func() {
Expect(session.ExitCode()).ToNot(BeZero())
})
- It("create container in pod with network should fail", func() {
+ It("create container in pod with network should not fail", func() {
name := "createwithnetwork"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
Expect(pod.ExitCode()).To(BeZero())
- session := podmanTest.Podman([]string{"create", "--pod", name, "--network", "foobar", ALPINE, "top"})
+ netName := "pod" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ session = podmanTest.Podman([]string{"create", "--pod", name, "--network", netName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- //Expect(session.ExitCode()).ToNot(BeZero())
Expect(session.ExitCode()).To(BeZero())
})
diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go
index 6a71f4d70..4370a2127 100644
--- a/test/e2e/diff_test.go
+++ b/test/e2e/diff_test.go
@@ -4,7 +4,7 @@ import (
"os"
"sort"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 0c7a1bd66..4dbbe9dd8 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -8,7 +8,7 @@ import (
"sync"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index b180d881a..2ffb5cd2e 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -5,7 +5,7 @@ import (
"os"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/exists_test.go b/test/e2e/exists_test.go
index 306e8c250..f0a55dd94 100644
--- a/test/e2e/exists_test.go
+++ b/test/e2e/exists_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go
index 4faacd626..61aebb5f2 100644
--- a/test/e2e/export_test.go
+++ b/test/e2e/export_test.go
@@ -4,7 +4,7 @@ import (
"os"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index cd949c666..d7c697f28 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -6,7 +6,7 @@ import (
"path/filepath"
"strconv"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/ghodss/yaml"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index 606d756b0..3a1da5d8c 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -4,7 +4,7 @@ import (
"io/ioutil"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -62,6 +62,42 @@ var _ = Describe("Podman generate systemd", func() {
Expect(session.ErrorToString()).To(ContainSubstring("bogus is not a valid restart policy"))
})
+ It("podman generate systemd with --no-header=true", func() {
+ session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"generate", "systemd", "foobar", "--no-header=true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ Expect(session.OutputToString()).NotTo(ContainSubstring("autogenerated by"))
+ })
+
+ It("podman generate systemd with --no-header", func() {
+ session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"generate", "systemd", "foobar", "--no-header"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ Expect(session.OutputToString()).NotTo(ContainSubstring("autogenerated by"))
+ })
+
+ It("podman generate systemd with --no-header=false", func() {
+ session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"generate", "systemd", "foobar", "--no-header=false"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ Expect(session.OutputToString()).To(ContainSubstring("autogenerated by"))
+ })
+
It("podman generate systemd good timeout value", func() {
session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
session.WaitWithDefaultTimeout()
@@ -235,6 +271,29 @@ var _ = Describe("Podman generate systemd", func() {
session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(" pod create "))
+ })
+
+ It("podman generate systemd --new=false pod", func() {
+ n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new=false", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).NotTo(ContainSubstring(" pod create "))
+ })
+
+ It("podman generate systemd --new=true pod", func() {
+ n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new=true", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(" pod create "))
})
It("podman generate systemd --container-prefix con", func() {
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index 403f15fa7..ed7958323 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -5,7 +5,7 @@ import (
"os"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go
index 1c57c60de..e2cf62d9a 100644
--- a/test/e2e/history_test.go
+++ b/test/e2e/history_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/image_sign_test.go b/test/e2e/image_sign_test.go
index 57739419c..704a78685 100644
--- a/test/e2e/image_sign_test.go
+++ b/test/e2e/image_sign_test.go
@@ -6,7 +6,7 @@ import (
"os/exec"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index 7c0d1cf78..29be505b7 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -6,7 +6,7 @@ import (
"sort"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/docker/go-units"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -194,7 +194,7 @@ WORKDIR /test
result := podmanTest.Podman([]string{"images", "-q", "-f", "since=quay.io/libpod/alpine:latest"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(7))
+ Expect(len(result.OutputToStringArray())).To(Equal(8))
})
It("podman image list filter after image", func() {
@@ -204,7 +204,7 @@ WORKDIR /test
result := podmanTest.Podman([]string{"image", "list", "-q", "-f", "after=quay.io/libpod/alpine:latest"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(result.OutputToStringArray()).Should(HaveLen(7), "list filter output: %q", result.OutputToString())
+ Expect(result.OutputToStringArray()).Should(HaveLen(8), "list filter output: %q", result.OutputToString())
})
It("podman images filter dangling", func() {
diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go
index bd465bf38..1f1b23bd0 100644
--- a/test/e2e/import_test.go
+++ b/test/e2e/import_test.go
@@ -4,7 +4,7 @@ import (
"os"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index bc4e6212b..3ce294b30 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -8,7 +8,7 @@ import (
"os/user"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go
index 3e64cfda2..d283e1f9a 100644
--- a/test/e2e/init_test.go
+++ b/test/e2e/init_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index 8fc9721f9..772ebed05 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -4,7 +4,7 @@ import (
"os"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -466,4 +466,46 @@ var _ = Describe("Podman inspect", func() {
Expect(len(inspect)).To(Equal(1))
Expect(len(inspect[0].NetworkSettings.Networks)).To(Equal(1))
})
+
+ It("Container inspect with unlimited uilimits should be -1", func() {
+ ctrName := "testctr"
+ session := podmanTest.Podman([]string{"run", "-d", "--ulimit", "core=-1:-1", "--name", ctrName, ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ inspect := podmanTest.Podman([]string{"inspect", ctrName})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(BeZero())
+
+ data := inspect.InspectContainerToJSON()
+ ulimits := data[0].HostConfig.Ulimits
+ Expect(len(ulimits)).To(BeNumerically(">", 0))
+ found := false
+ for _, ulimit := range ulimits {
+ if ulimit.Name == "RLIMIT_CORE" {
+ found = true
+ Expect(ulimit.Soft).To(BeNumerically("==", -1))
+ Expect(ulimit.Hard).To(BeNumerically("==", -1))
+ }
+ }
+ Expect(found).To(BeTrue())
+ })
+
+ It("Dropped capabilities are sorted", func() {
+ ctrName := "testCtr"
+ session := podmanTest.Podman([]string{"run", "-d", "--cap-drop", "CAP_AUDIT_WRITE", "--cap-drop", "CAP_MKNOD", "--cap-drop", "CAP_NET_RAW", "--name", ctrName, ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ inspect := podmanTest.Podman([]string{"inspect", ctrName})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(BeZero())
+
+ data := inspect.InspectContainerToJSON()
+ Expect(len(data)).To(Equal(1))
+ Expect(len(data[0].HostConfig.CapDrop)).To(Equal(3))
+ Expect(data[0].HostConfig.CapDrop[0]).To(Equal("CAP_AUDIT_WRITE"))
+ Expect(data[0].HostConfig.CapDrop[1]).To(Equal("CAP_MKNOD"))
+ Expect(data[0].HostConfig.CapDrop[2]).To(Equal("CAP_NET_RAW"))
+ })
})
diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go
index c1c1b003e..a9f21fa70 100644
--- a/test/e2e/kill_test.go
+++ b/test/e2e/kill_test.go
@@ -4,7 +4,7 @@ import (
"io/ioutil"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -51,6 +51,19 @@ var _ = Describe("Podman kill", func() {
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
+ It("podman container kill a running container by short id", func() {
+ session := podmanTest.RunTopContainer("")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+
+ result := podmanTest.Podman([]string{"container", "kill", cid[:5]})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(result.OutputToString()).To(Equal(cid[:5]))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ })
+
It("podman kill a running container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index da57bb4c0..a26765ee9 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -15,7 +15,7 @@ import (
"syscall"
"time"
- "github.com/containers/podman/v2/pkg/rootless"
+ "github.com/containers/podman/v3/pkg/rootless"
"github.com/onsi/ginkgo"
)
diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go
index ffbb9b44f..267f18b0a 100644
--- a/test/e2e/load_test.go
+++ b/test/e2e/load_test.go
@@ -5,7 +5,7 @@ import (
"os"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go
index a2e88ecd2..99876de29 100644
--- a/test/e2e/login_logout_test.go
+++ b/test/e2e/login_logout_test.go
@@ -9,7 +9,7 @@ import (
"strconv"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
. "github.com/onsi/gomega"
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index b370aeec1..8f695279a 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -6,7 +6,7 @@ import (
"os/exec"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -36,345 +36,341 @@ var _ = Describe("Podman logs", func() {
})
- It("all lines", func() {
- logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
-
- cid := logc.OutputToString()
- results := podmanTest.Podman([]string{"logs", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
- })
-
- It("tail two lines", func() {
- logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--tail", "2", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(2))
- })
-
- It("tail zero lines", func() {
- logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--tail", "0", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(0))
- })
-
- It("tail 800 lines", func() {
- logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "i=1; while [ \"$i\" -ne 1000 ]; do echo \"line $i\"; i=$((i + 1)); done"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--tail", "800", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(800))
- })
-
- It("tail 2 lines with timestamps", func() {
- logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(2))
- })
-
- It("since time 2017-08-07", func() {
- logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
- })
-
- It("since duration 10m", func() {
- logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--since", "10m", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
- })
-
- It("latest and container name should fail", func() {
- results := podmanTest.Podman([]string{"logs", "-l", "foobar"})
- results.WaitWithDefaultTimeout()
- Expect(results).To(ExitWithError())
- })
-
- It("two containers showing short container IDs", func() {
- SkipIfRemote("FIXME: podman-remote logs does not support showing two containers at the same time")
- log1 := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- log1.WaitWithDefaultTimeout()
- Expect(log1.ExitCode()).To(Equal(0))
- cid1 := log1.OutputToString()
-
- log2 := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- log2.WaitWithDefaultTimeout()
- Expect(log2.ExitCode()).To(Equal(0))
- cid2 := log2.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", cid1, cid2})
- results.WaitWithDefaultTimeout()
- Expect(results).Should(Exit(0))
-
- output := results.OutputToStringArray()
- Expect(len(output)).To(Equal(6))
- Expect(strings.Contains(output[0], cid1[:12]) || strings.Contains(output[0], cid2[:12])).To(BeTrue())
- })
-
- It("podman logs on a created container should result in 0 exit code", func() {
- session := podmanTest.Podman([]string{"create", "-t", "--name", "log", ALPINE})
- session.WaitWithDefaultTimeout()
- Expect(session).To(Exit(0))
-
- results := podmanTest.Podman([]string{"logs", "log"})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- })
+ for _, log := range []string{"k8s-file", "journald", "json-file"} {
+ It("all lines: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+
+ cid := logc.OutputToString()
+ results := podmanTest.Podman([]string{"logs", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
+ })
+
+ It("tail two lines: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--tail", "2", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(2))
+ })
+
+ It("tail zero lines: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--tail", "0", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(0))
+ })
+
+ It("tail 800 lines: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "i=1; while [ \"$i\" -ne 1000 ]; do echo \"line $i\"; i=$((i + 1)); done"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--tail", "800", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(800))
+ })
+
+ It("tail 2 lines with timestamps: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(2))
+ })
+
+ It("since time 2017-08-07: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
+ })
+
+ It("since duration 10m: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--since", "10m", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
+ })
+
+ It("latest and container name should fail: "+log, func() {
+ results := podmanTest.Podman([]string{"logs", "-l", "foobar"})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(ExitWithError())
+ })
+
+ It("two containers showing short container IDs: "+log, func() {
+ SkipIfRemote("FIXME: podman-remote logs does not support showing two containers at the same time")
+ log1 := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ log1.WaitWithDefaultTimeout()
+ Expect(log1.ExitCode()).To(Equal(0))
+ cid1 := log1.OutputToString()
+
+ log2 := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ log2.WaitWithDefaultTimeout()
+ Expect(log2.ExitCode()).To(Equal(0))
+ cid2 := log2.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", cid1, cid2})
+ results.WaitWithDefaultTimeout()
+ Expect(results).Should(Exit(0))
+
+ output := results.OutputToStringArray()
+ Expect(len(output)).To(Equal(6))
+ Expect(strings.Contains(output[0], cid1[:12]) || strings.Contains(output[0], cid2[:12])).To(BeTrue())
+ })
+
+ It("podman logs on a created container should result in 0 exit code: "+log, func() {
+ session := podmanTest.Podman([]string{"create", "-t", "--name", "log", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"logs", "log"})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ })
+
+ It("for container: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(results.OutputToString()).To(Equal("podman podman podman"))
+ })
+
+ It("tail two lines: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+ results := podmanTest.Podman([]string{"logs", "--tail", "2", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(2))
+ })
+
+ It("tail 99 lines: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--tail", "99", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
+ })
+
+ It("tail 2 lines with timestamps: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(2))
+ })
+
+ It("since time 2017-08-07: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
+ })
+
+ It("with duration 10m: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", "--since", "10m", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
+ })
+
+ It("streaming output: "+log, func() {
+ containerName := "logs-f-rm"
+
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--rm", "--name", containerName, "-dt", ALPINE, "sh", "-c", "echo podman; sleep 1; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"logs", "-f", containerName})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+
+ // TODO: we should actually check for two podman lines,
+ // but as of 2020-06-17 there's a race condition in which
+ // 'logs -f' may not catch all output from a container
+ Expect(results.OutputToString()).To(ContainSubstring("podman"))
+
+ // Container should now be terminatING or terminatED, but we
+ // have no guarantee of which: 'logs -f' does not necessarily
+ // wait for cleanup. Run 'inspect' and accept either state.
+ inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.State.Status}}", containerName})
+ inspect.WaitWithDefaultTimeout()
+ if inspect.ExitCode() == 0 {
+ Expect(inspect.OutputToString()).To(Equal("exited"))
+ // TODO: add 2-second wait loop to confirm cleanup
+ } else {
+ Expect(inspect.ErrorToString()).To(ContainSubstring("no such container"))
+ }
+ })
+
+ It("podman logs with log-driver=none errors: "+log, func() {
+ ctrName := "logsctr"
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", ctrName, "-d", "--log-driver", "none", ALPINE, "top"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+
+ logs := podmanTest.Podman([]string{"logs", "-f", ctrName})
+ logs.WaitWithDefaultTimeout()
+ Expect(logs).To(Not(Exit(0)))
+ })
+
+ It("follow output stopped container: "+log, func() {
+ containerName := "logs-f"
+
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName, "-d", ALPINE, "true"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"logs", "-f", containerName})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ })
+
+ It("using container with container log-size: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--log-opt=max-size=10k", "-d", ALPINE, "sh", "-c", "echo podman podman podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+ cid := logc.OutputToString()
+
+ wait := podmanTest.Podman([]string{"wait", cid})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait).To(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.HostConfig.LogConfig.Size}}", cid})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).To(Exit(0))
+ Expect(inspect.OutputToString()).To(Equal("10kB"))
+
+ results := podmanTest.Podman([]string{"logs", cid})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(results.OutputToString()).To(Equal("podman podman podman"))
+ })
+
+ It("Make sure logs match expected length: "+log, func() {
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-t", "--name", "test", ALPINE, "sh", "-c", "echo 1; echo 2"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+
+ wait := podmanTest.Podman([]string{"wait", "test"})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"logs", "test"})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ outlines := results.OutputToStringArray()
+ Expect(len(outlines)).To(Equal(2))
+ Expect(outlines[0]).To(Equal("1\r"))
+ Expect(outlines[1]).To(Equal("2\r"))
+ })
+
+ It("podman logs test stdout and stderr: "+log, func() {
+ cname := "log-test"
+ logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", cname, ALPINE, "sh", "-c", "echo stdout; echo stderr >&2"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+
+ wait := podmanTest.Podman([]string{"wait", cname})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"logs", cname})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ Expect(results.OutputToString()).To(Equal("stdout"))
+ Expect(results.ErrorToString()).To(Equal("stderr"))
+ })
+ }
It("using journald for container with container tag", func() {
- Skip("need to verify images have correct packages for journald")
+ SkipIfInContainer("journalctl inside a container doesn't work correctly")
logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "--log-opt=tag={{.ImageName}}", "-d", ALPINE, "sh", "-c", "echo podman; sleep 0.1; echo podman; sleep 0.1; echo podman"})
logc.WaitWithDefaultTimeout()
Expect(logc).To(Exit(0))
cid := logc.OutputToString()
- wait := podmanTest.Podman([]string{"wait", "-l"})
+ wait := podmanTest.Podman([]string{"wait", cid})
wait.WaitWithDefaultTimeout()
Expect(wait).To(Exit(0))
- cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_TAG", "-u", fmt.Sprintf("libpod-conmon-%s.scope", cid))
+ cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_TAG", fmt.Sprintf("CONTAINER_ID_FULL=%s", cid))
out, err := cmd.CombinedOutput()
Expect(err).To(BeNil())
Expect(string(out)).To(ContainSubstring("alpine"))
})
- It("using journald for container name", func() {
- Skip("need to verify images have correct packages for journald")
+ It("using journald container name", func() {
+ SkipIfInContainer("journalctl inside a container doesn't work correctly")
containerName := "inside-journal"
logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-d", "--name", containerName, ALPINE, "sh", "-c", "echo podman; sleep 0.1; echo podman; sleep 0.1; echo podman"})
logc.WaitWithDefaultTimeout()
Expect(logc).To(Exit(0))
cid := logc.OutputToString()
- wait := podmanTest.Podman([]string{"wait", "-l"})
+ wait := podmanTest.Podman([]string{"wait", cid})
wait.WaitWithDefaultTimeout()
Expect(wait).To(Exit(0))
- cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_NAME", "-u", fmt.Sprintf("libpod-conmon-%s.scope", cid))
+ cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_NAME", fmt.Sprintf("CONTAINER_ID_FULL=%s", cid))
out, err := cmd.CombinedOutput()
Expect(err).To(BeNil())
Expect(string(out)).To(ContainSubstring(containerName))
})
-
- It("using journald for container", func() {
- Skip("need to verify images have correct packages for journald")
- logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
- Expect(results.OutputToString()).To(Equal("podman podman podman"))
- })
-
- It("using journald tail two lines", func() {
- Skip("need to verify images have correct packages for journald")
- logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
- results := podmanTest.Podman([]string{"logs", "--tail", "2", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(2))
- })
-
- It("using journald tail 99 lines", func() {
- Skip("need to verify images have correct packages for journald")
- logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--tail", "99", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
- })
-
- It("using journald tail 2 lines with timestamps", func() {
- Skip("need to verify images have correct packages for journald")
- logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(2))
- })
-
- It("using journald since time 2017-08-07", func() {
- Skip("need to verify images have correct packages for journald")
- logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
- })
-
- It("using journald with duration 10m", func() {
- Skip("need to verify images have correct packages for journald")
- logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- results := podmanTest.Podman([]string{"logs", "--since", "10m", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
- })
-
- It("streaming output", func() {
- containerName := "logs-f-rm"
-
- logc := podmanTest.Podman([]string{"run", "--rm", "--name", containerName, "-dt", ALPINE, "sh", "-c", "echo podman; sleep 1; echo podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
-
- results := podmanTest.Podman([]string{"logs", "-f", containerName})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
-
- // TODO: we should actually check for two podman lines,
- // but as of 2020-06-17 there's a race condition in which
- // 'logs -f' may not catch all output from a container
- Expect(results.OutputToString()).To(ContainSubstring("podman"))
-
- // Container should now be terminatING or terminatED, but we
- // have no guarantee of which: 'logs -f' does not necessarily
- // wait for cleanup. Run 'inspect' and accept either state.
- inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.State.Status}}", containerName})
- inspect.WaitWithDefaultTimeout()
- if inspect.ExitCode() == 0 {
- Expect(inspect.OutputToString()).To(Equal("exited"))
- // TODO: add 2-second wait loop to confirm cleanup
- } else {
- Expect(inspect.ErrorToString()).To(ContainSubstring("no such container"))
- }
- })
-
- It("podman logs with log-driver=none errors", func() {
- ctrName := "logsctr"
- logc := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--log-driver", "none", ALPINE, "top"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
-
- logs := podmanTest.Podman([]string{"logs", "-f", ctrName})
- logs.WaitWithDefaultTimeout()
- Expect(logs).To(Not(Exit(0)))
- })
-
- It("follow output stopped container", func() {
- containerName := "logs-f"
-
- logc := podmanTest.Podman([]string{"run", "--name", containerName, "-d", ALPINE, "true"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
-
- results := podmanTest.Podman([]string{"logs", "-f", containerName})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- })
-
- It("using container with container log-size", func() {
- logc := podmanTest.Podman([]string{"run", "--log-opt=max-size=10k", "-d", ALPINE, "sh", "-c", "echo podman podman podman"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
- cid := logc.OutputToString()
-
- wait := podmanTest.Podman([]string{"wait", cid})
- wait.WaitWithDefaultTimeout()
- Expect(wait).To(Exit(0))
-
- inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.HostConfig.LogConfig.Size}}", cid})
- inspect.WaitWithDefaultTimeout()
- Expect(inspect).To(Exit(0))
- Expect(inspect.OutputToString()).To(Equal("10kB"))
-
- results := podmanTest.Podman([]string{"logs", cid})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(results.OutputToString()).To(Equal("podman podman podman"))
- })
-
- It("Make sure logs match expected length", func() {
- logc := podmanTest.Podman([]string{"run", "-t", "--name", "test", ALPINE, "sh", "-c", "echo 1; echo 2"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
-
- wait := podmanTest.Podman([]string{"wait", "test"})
- wait.WaitWithDefaultTimeout()
- Expect(wait).To(Exit(0))
-
- results := podmanTest.Podman([]string{"logs", "test"})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- outlines := results.OutputToStringArray()
- Expect(len(outlines)).To(Equal(2))
- Expect(outlines[0]).To(Equal("1\r"))
- Expect(outlines[1]).To(Equal("2\r"))
- })
-
- It("podman logs test stdout and stderr", func() {
- cname := "log-test"
- logc := podmanTest.Podman([]string{"run", "--name", cname, ALPINE, "sh", "-c", "echo stdout; echo stderr >&2"})
- logc.WaitWithDefaultTimeout()
- Expect(logc).To(Exit(0))
-
- wait := podmanTest.Podman([]string{"wait", cname})
- wait.WaitWithDefaultTimeout()
- Expect(wait).To(Exit(0))
-
- results := podmanTest.Podman([]string{"logs", cname})
- results.WaitWithDefaultTimeout()
- Expect(results).To(Exit(0))
- Expect(results.OutputToString()).To(Equal("stdout"))
- Expect(results.ErrorToString()).To(Equal("stderr"))
- })
})
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index e6ac83aea..18be97a89 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -5,7 +5,7 @@ import (
"path/filepath"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go
index c410a2507..502bdef4e 100644
--- a/test/e2e/mount_rootless_test.go
+++ b/test/e2e/mount_rootless_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go
index c9274553b..ee77f2984 100644
--- a/test/e2e/mount_test.go
+++ b/test/e2e/mount_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/namespace_test.go b/test/e2e/namespace_test.go
index 951e98dfc..0c451d6cd 100644
--- a/test/e2e/namespace_test.go
+++ b/test/e2e/namespace_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/negative_test.go b/test/e2e/negative_test.go
index 9c879fb8b..c3cef2e8e 100644
--- a/test/e2e/negative_test.go
+++ b/test/e2e/negative_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go
index cc23b10c1..eb8ad7181 100644
--- a/test/e2e/network_connect_disconnect_test.go
+++ b/test/e2e/network_connect_disconnect_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -37,7 +37,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
dis := podmanTest.Podman([]string{"network", "disconnect", "foobar", "test"})
dis.WaitWithDefaultTimeout()
Expect(dis.ExitCode()).ToNot(BeZero())
-
})
It("bad container name in network disconnect should result in error", func() {
@@ -51,7 +50,25 @@ var _ = Describe("Podman network connect and disconnect", func() {
dis := podmanTest.Podman([]string{"network", "disconnect", netName, "foobar"})
dis.WaitWithDefaultTimeout()
Expect(dis.ExitCode()).ToNot(BeZero())
+ })
+
+ It("network disconnect with net mode slirp4netns should result in error", func() {
+ SkipIfRootless("network connect and disconnect are only rootful")
+ netName := "slirp" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ session = podmanTest.Podman([]string{"create", "--name", "test", "--network", "slirp4netns", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+ con := podmanTest.Podman([]string{"network", "disconnect", netName, "test"})
+ con.WaitWithDefaultTimeout()
+ Expect(con.ExitCode()).ToNot(BeZero())
+ Expect(con.ErrorToString()).To(ContainSubstring(`network mode "slirp4netns" is not supported`))
})
It("podman network disconnect", func() {
@@ -89,7 +106,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
dis := podmanTest.Podman([]string{"network", "connect", "foobar", "test"})
dis.WaitWithDefaultTimeout()
Expect(dis.ExitCode()).ToNot(BeZero())
-
})
It("bad container name in network connect should result in error", func() {
@@ -103,7 +119,25 @@ var _ = Describe("Podman network connect and disconnect", func() {
dis := podmanTest.Podman([]string{"network", "connect", netName, "foobar"})
dis.WaitWithDefaultTimeout()
Expect(dis.ExitCode()).ToNot(BeZero())
+ })
+
+ It("network connect with net mode slirp4netns should result in error", func() {
+ SkipIfRootless("network connect and disconnect are only rootful")
+ netName := "slirp" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ session = podmanTest.Podman([]string{"create", "--name", "test", "--network", "slirp4netns", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+ con := podmanTest.Podman([]string{"network", "connect", netName, "test"})
+ con.WaitWithDefaultTimeout()
+ Expect(con.ExitCode()).ToNot(BeZero())
+ Expect(con.ErrorToString()).To(ContainSubstring(`network mode "slirp4netns" is not supported`))
})
It("podman connect on a container that already is connected to the network should error", func() {
@@ -195,6 +229,55 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(exec.ExitCode()).To(BeZero())
})
+ It("podman network connect and run with network ID", func() {
+ SkipIfRemote("remote flakes to much I will fix this in another PR")
+ SkipIfRootless("network connect and disconnect are only rootful")
+ netName := "ID" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.ID}}", "--filter", "name=" + netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ netID := session.OutputToString()
+
+ ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netID, ALPINE, "top"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(BeZero())
+
+ exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+
+ // Create a second network
+ newNetName := "ID2" + stringid.GenerateNonCryptoID()
+ session = podmanTest.Podman([]string{"network", "create", newNetName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(newNetName)
+
+ session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.ID}}", "--filter", "name=" + newNetName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ newNetID := session.OutputToString()
+
+ connect := podmanTest.Podman([]string{"network", "connect", newNetID, "test"})
+ connect.WaitWithDefaultTimeout()
+ Expect(connect.ExitCode()).To(BeZero())
+
+ inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{.NetworkSettings.Networks}}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect.OutputToString()).To(ContainSubstring(netName))
+ Expect(inspect.OutputToString()).To(ContainSubstring(newNetName))
+
+ exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+ })
+
It("podman network disconnect when not running", func() {
SkipIfRootless("network connect and disconnect are only rootful")
netName1 := "aliasTest" + stringid.GenerateNonCryptoID()
@@ -234,4 +317,40 @@ var _ = Describe("Podman network connect and disconnect", func() {
exec.WaitWithDefaultTimeout()
Expect(exec.ExitCode()).ToNot(BeZero())
})
+
+ It("podman network disconnect and run with network ID", func() {
+ SkipIfRemote("remote flakes to much I will fix this in another PR")
+ SkipIfRootless("network connect and disconnect are only rootful")
+ netName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.ID}}", "--filter", "name=" + netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ netID := session.OutputToString()
+
+ ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netID, ALPINE, "top"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(BeZero())
+
+ exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+
+ dis := podmanTest.Podman([]string{"network", "disconnect", netID, "test"})
+ dis.WaitWithDefaultTimeout()
+ Expect(dis.ExitCode()).To(BeZero())
+
+ inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect.OutputToString()).To(Equal("0"))
+
+ exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).ToNot(BeZero())
+ })
})
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index 1bf2a2691..ef3be8e22 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -8,8 +8,8 @@ import (
"strings"
cniversion "github.com/containernetworking/cni/pkg/version"
- "github.com/containers/podman/v2/libpod/network"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/libpod/network"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index d4e1a3698..53521cdc4 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -6,8 +6,8 @@ import (
"strings"
"time"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -150,6 +150,13 @@ var _ = Describe("Podman network", func() {
defer podmanTest.removeCNINetwork(net)
Expect(session.ExitCode()).To(BeZero())
+ // Tests Default Table Output
+ session = podmanTest.Podman([]string{"network", "ls", "--filter", "id=" + netID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ expectedTable := "NETWORK ID NAME VERSION PLUGINS"
+ Expect(session.OutputToString()).To(ContainSubstring(expectedTable))
+
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(BeZero())
@@ -407,6 +414,7 @@ var _ = Describe("Podman network", func() {
Expect(lines[0]).To(Equal(netName1))
Expect(lines[1]).To(Equal(netName2))
})
+
It("podman network with multiple aliases", func() {
var worked bool
netName := "aliasTest" + stringid.GenerateNonCryptoID()
@@ -415,16 +423,28 @@ var _ = Describe("Podman network", func() {
defer podmanTest.removeCNINetwork(netName)
Expect(session.ExitCode()).To(BeZero())
+ interval := time.Duration(250 * time.Millisecond)
+ for i := 0; i < 6; i++ {
+ n := podmanTest.Podman([]string{"network", "exists", netName})
+ n.WaitWithDefaultTimeout()
+ worked = n.ExitCode() == 0
+ if worked {
+ break
+ }
+ time.Sleep(interval)
+ interval *= 2
+ }
+
top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", nginx})
top.WaitWithDefaultTimeout()
Expect(top.ExitCode()).To(BeZero())
- interval := time.Duration(250 * time.Millisecond)
+ interval = time.Duration(250 * time.Millisecond)
// Wait for the nginx service to be running
for i := 0; i < 6; i++ {
// Test curl against the container's name
- c1 := podmanTest.Podman([]string{"run", "--network=" + netName, nginx, "curl", "web"})
+ c1 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web"})
c1.WaitWithDefaultTimeout()
- worked = Expect(c1.ExitCode()).To(BeZero())
+ worked = c1.ExitCode() == 0
if worked {
break
}
@@ -435,12 +455,12 @@ var _ = Describe("Podman network", func() {
// Nginx is now running so no need to do a loop
// Test against the first alias
- c2 := podmanTest.Podman([]string{"run", "--network=" + netName, nginx, "curl", "web1"})
+ c2 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web1"})
c2.WaitWithDefaultTimeout()
Expect(c2.ExitCode()).To(BeZero())
// Test against the second alias
- c3 := podmanTest.Podman([]string{"run", "--network=" + netName, nginx, "curl", "web2"})
+ c3 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web2"})
c3.WaitWithDefaultTimeout()
Expect(c3.ExitCode()).To(BeZero())
})
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go
index a90ffcc87..01ad7c071 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 2e5c72b0e..9260d6cd2 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -10,7 +10,7 @@ import (
"strings"
"text/template"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opencontainers/selinux/go-selinux"
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index e57712f62..a70d9f13f 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -7,8 +7,8 @@ import (
"path/filepath"
"strings"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -501,4 +501,18 @@ entrypoint ["/fromimage"]
Expect(session.OutputToString()).To(ContainSubstring("inet 127.0.0.1/8 scope host lo"))
Expect(len(session.OutputToStringArray())).To(Equal(1))
})
+
+ It("podman pod create --infra-image w/untagged image", func() {
+ podmanTest.AddImageToRWStore(ALPINE)
+ dockerfile := `FROM quay.io/libpod/alpine:latest
+ENTRYPOINT ["sleep","99999"]
+ `
+ // This builds a none/none image
+ iid := podmanTest.BuildImage(dockerfile, "", "true")
+
+ create := podmanTest.Podman([]string{"pod", "create", "--infra-image", iid})
+ create.WaitWithDefaultTimeout()
+ Expect(create.ExitCode()).To(BeZero())
+ })
+
})
diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go
index 452a3de21..09f0d4e33 100644
--- a/test/e2e/pod_infra_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -4,7 +4,7 @@ import (
"os"
"strconv"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index d9c4a393a..036b08570 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -4,8 +4,8 @@ import (
"encoding/json"
"os"
- "github.com/containers/podman/v2/libpod/define"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/libpod/define"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go
index 06d244f99..92dcad292 100644
--- a/test/e2e/pod_kill_test.go
+++ b/test/e2e/pod_kill_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go
index 0c1b39f38..da3b106fa 100644
--- a/test/e2e/pod_pause_test.go
+++ b/test/e2e/pod_pause_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_pod_namespaces_test.go b/test/e2e/pod_pod_namespaces_test.go
index 20b8bdb39..ce93db63c 100644
--- a/test/e2e/pod_pod_namespaces_test.go
+++ b/test/e2e/pod_pod_namespaces_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go
index d1ebf7249..2def95308 100644
--- a/test/e2e/pod_prune_test.go
+++ b/test/e2e/pod_prune_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index c20cb44e7..c5c0827bc 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -5,7 +5,7 @@ import (
"os"
"sort"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go
index c6b1a0d46..006421b93 100644
--- a/test/e2e/pod_restart_test.go
+++ b/test/e2e/pod_restart_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index 40a903cd0..6d710f020 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go
index e14796ab3..5838f3310 100644
--- a/test/e2e/pod_start_test.go
+++ b/test/e2e/pod_start_test.go
@@ -7,7 +7,7 @@ import (
"strconv"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index 073d4752b..2064cdc9f 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go
index 30a5632d0..45e2f86a6 100644
--- a/test/e2e/pod_stop_test.go
+++ b/test/e2e/pod_stop_test.go
@@ -4,7 +4,7 @@ import (
"io/ioutil"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go
index e191b44fc..9d9c138c4 100644
--- a/test/e2e/pod_top_test.go
+++ b/test/e2e/pod_top_test.go
@@ -5,7 +5,7 @@ import (
"os"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go
index 4aaf2cbc1..e9bbc2adc 100644
--- a/test/e2e/port_test.go
+++ b/test/e2e/port_test.go
@@ -5,7 +5,7 @@ import (
"os"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index f84312103..73da77417 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -111,7 +111,6 @@ var _ = Describe("Podman prune", func() {
It("podman image prune dangling images", func() {
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
-
none := podmanTest.Podman([]string{"images", "-a"})
none.WaitWithDefaultTimeout()
Expect(none.ExitCode()).To(Equal(0))
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index db3f7a36b..ac0910a83 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -5,9 +5,10 @@ import (
"os"
"regexp"
"sort"
+ "strconv"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
"github.com/docker/go-units"
. "github.com/onsi/ginkgo"
@@ -210,6 +211,22 @@ var _ = Describe("Podman ps", func() {
Expect(result.IsJSONOutputValid()).To(BeTrue())
})
+ It("podman ps json format Created field is int64", func() {
+ session := podmanTest.RunTopContainer("test1")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"ps", "--format", "json"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+
+ // Make sure Created field is an int64
+ created, err := result.jq(".[0].Created")
+ Expect(err).To(BeNil())
+ _, err = strconv.ParseInt(created, 10, 64)
+ Expect(err).To(BeNil())
+ })
+
It("podman ps print a human-readable `Status` with json format", func() {
_, ec, _ := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
@@ -333,6 +350,21 @@ var _ = Describe("Podman ps", func() {
Expect(session).To(ExitWithError())
})
+ It("podman --format by size", func() {
+ session := podmanTest.Podman([]string{"create", "busybox", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"ps", "-a", "--format", "{{.Size}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).To(ContainSubstring("Size format requires --size option"))
+ })
+
It("podman --sort by size", func() {
session := podmanTest.Podman([]string{"create", "busybox", "ls"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index d47a3e47a..5308548f1 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -7,7 +7,7 @@ import (
"runtime"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 00b5802a3..cc7c67941 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -6,8 +6,8 @@ import (
"path/filepath"
"strings"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/rename_test.go b/test/e2e/rename_test.go
index 7affbaf56..f19413221 100644
--- a/test/e2e/rename_test.go
+++ b/test/e2e/rename_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index bfe9563ea..dc8e64e63 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -4,7 +4,7 @@ import (
"os"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go
index 4c50a61ef..788d14141 100644
--- a/test/e2e/rm_test.go
+++ b/test/e2e/rm_test.go
@@ -4,7 +4,7 @@ import (
"io/ioutil"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index 257570ea7..d8367d636 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -5,7 +5,7 @@ import (
"os"
"sync"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go
index 0faf0b496..63c52451f 100644
--- a/test/e2e/run_apparmor_test.go
+++ b/test/e2e/run_apparmor_test.go
@@ -9,7 +9,7 @@ import (
"path/filepath"
"github.com/containers/common/pkg/apparmor"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go
index 35628d44b..d68b1bb5f 100644
--- a/test/e2e/run_cgroup_parent_test.go
+++ b/test/e2e/run_cgroup_parent_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go
index 5f6c9007a..2dfaf1329 100644
--- a/test/e2e/run_cleanup_test.go
+++ b/test/e2e/run_cleanup_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go
index d8b57c230..2f4452ba4 100644
--- a/test/e2e/run_cpu_test.go
+++ b/test/e2e/run_cpu_test.go
@@ -4,7 +4,7 @@ import (
"io/ioutil"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go
index 1c2602631..5a32ed827 100644
--- a/test/e2e/run_device_test.go
+++ b/test/e2e/run_device_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go
index c8996c5e8..05f8c3f99 100644
--- a/test/e2e/run_dns_test.go
+++ b/test/e2e/run_dns_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index cac3d759d..ddad89c85 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -43,6 +43,18 @@ CMD []
Expect(session.ExitCode()).To(Equal(125))
})
+ It("podman run entrypoint == [\"\"]", func() {
+ dockerfile := `FROM quay.io/libpod/alpine:latest
+ENTRYPOINT [""]
+CMD []
+`
+ podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
+ session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "echo", "hello"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal("hello"))
+ })
+
It("podman run entrypoint", func() {
dockerfile := `FROM quay.io/libpod/alpine:latest
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go
index 9882b936a..83d8e8da6 100644
--- a/test/e2e/run_env_test.go
+++ b/test/e2e/run_env_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_exit_test.go b/test/e2e/run_exit_test.go
index 0579e29fa..3d969cbc2 100644
--- a/test/e2e/run_exit_test.go
+++ b/test/e2e/run_exit_test.go
@@ -3,8 +3,8 @@ package integration
import (
"os"
- "github.com/containers/podman/v2/libpod/define"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/libpod/define"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index ad3a2b54f..cb13993f4 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -2,8 +2,9 @@ package integration
import (
"os"
+ "strconv"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -90,4 +91,27 @@ var _ = Describe("Podman run memory", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("41943040"))
})
+
+ It("podman run kernel-memory test", func() {
+ if podmanTest.Host.Distribution == "ubuntu" {
+ Skip("Unable to perform test on Ubuntu distributions due to memory management")
+ }
+ var session *PodmanSessionIntegration
+ if CGROUPSV2 {
+ session = podmanTest.Podman([]string{"run", "--memory", "256m", "--memory-swap", "-1", ALPINE, "cat", "/sys/fs/cgroup/memory.swap.max"})
+ } else {
+ session = podmanTest.Podman([]string{"run", "--cgroupns=private", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"})
+ }
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ output := session.OutputToString()
+ Expect(err).To(BeNil())
+ if CGROUPSV2 {
+ Expect(output).To(Equal("max"))
+ } else {
+ crazyHighNumber, err := strconv.ParseInt(output, 10, 64)
+ Expect(err).To(BeZero())
+ Expect(crazyHighNumber).To(BeNumerically(">", 936854771712))
+ }
+ })
})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 676f24e5d..0e6e636bc 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -5,7 +5,7 @@ import (
"os"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -766,4 +766,18 @@ var _ = Describe("Podman run networking", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(BeZero())
})
+
+ It("podman run check dnsname adds dns search domain", func() {
+ Skip("needs dnsname#57")
+ net := "dnsname" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", net})
+ session.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net)
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"run", "--network", net, ALPINE, "cat", "/etc/resolv.conf"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(session.OutputToString()).To(ContainSubstring("search dns.podman"))
+ })
})
diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go
index 29d2d4395..c72891107 100644
--- a/test/e2e/run_ns_test.go
+++ b/test/e2e/run_ns_test.go
@@ -5,7 +5,7 @@ import (
"os/exec"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go
index e7b86c68b..12b6c64df 100644
--- a/test/e2e/run_passwd_test.go
+++ b/test/e2e/run_passwd_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index 48f9ea76e..33b3b85c5 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -5,7 +5,7 @@ import (
"strconv"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/syndtr/gocapability/capability"
diff --git a/test/e2e/run_restart_test.go b/test/e2e/run_restart_test.go
index 85621a762..c996bdb25 100644
--- a/test/e2e/run_restart_test.go
+++ b/test/e2e/run_restart_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_seccomp_test.go b/test/e2e/run_seccomp_test.go
index 7d04cc60a..ed1cdeecd 100644
--- a/test/e2e/run_seccomp_test.go
+++ b/test/e2e/run_seccomp_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_security_labels_test.go b/test/e2e/run_security_labels_test.go
index 0c5621e3f..a2e0b2aab 100644
--- a/test/e2e/run_security_labels_test.go
+++ b/test/e2e/run_security_labels_test.go
@@ -4,7 +4,7 @@ import (
"os"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go
index 2e9d38e2d..8c712b1be 100644
--- a/test/e2e/run_selinux_test.go
+++ b/test/e2e/run_selinux_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opencontainers/selinux/go-selinux"
diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go
index 58b8d04e5..f601bee72 100644
--- a/test/e2e/run_signal_test.go
+++ b/test/e2e/run_signal_test.go
@@ -9,8 +9,8 @@ import (
"syscall"
"time"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"golang.org/x/sys/unix"
diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go
index aeb462ae9..bff142b12 100644
--- a/test/e2e/run_staticip_test.go
+++ b/test/e2e/run_staticip_test.go
@@ -6,7 +6,7 @@ import (
"os"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 76d362288..f0ba9d1d9 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -11,7 +11,7 @@ import (
"syscall"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
"github.com/mrunalp/fileutils"
. "github.com/onsi/ginkgo"
@@ -47,6 +47,29 @@ var _ = Describe("Podman run", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman run check /run/.containerenv", func() {
+ session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/run/.containerenv"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal(""))
+
+ session = podmanTest.Podman([]string{"run", "--privileged", "--name=test1", ALPINE, "cat", "/run/.containerenv"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("name=\"test1\""))
+ Expect(session.OutputToString()).To(ContainSubstring("image=\"" + ALPINE + "\""))
+
+ session = podmanTest.Podman([]string{"run", "-v", "/:/host", ALPINE, "cat", "/run/.containerenv"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("graphRootMounted=1"))
+
+ session = podmanTest.Podman([]string{"run", "-v", "/:/host", "--privileged", ALPINE, "cat", "/run/.containerenv"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("graphRootMounted=1"))
+ })
+
It("podman run a container based on a complex local image name", func() {
imageName := strings.TrimPrefix(nginx, "quay.io/")
session := podmanTest.Podman([]string{"run", imageName, "ls"})
@@ -332,6 +355,9 @@ var _ = Describe("Podman run", func() {
It("podman run user capabilities test", func() {
// We need to ignore the containers.conf on the test distribution for this test
os.Setenv("CONTAINERS_CONF", "/dev/null")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
session := podmanTest.Podman([]string{"run", "--rm", "--user", "bin", ALPINE, "grep", "CapBnd", "/proc/self/status"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -424,6 +450,9 @@ var _ = Describe("Podman run", func() {
It("podman run user capabilities test with image", func() {
// We need to ignore the containers.conf on the test distribution for this test
os.Setenv("CONTAINERS_CONF", "/dev/null")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
dockerfile := `FROM busybox
USER bin`
podmanTest.BuildImage(dockerfile, "test", "false")
@@ -1185,6 +1214,38 @@ USER mail`
Expect(found).To(BeTrue())
})
+ It("podman run with cgroups=split", func() {
+ SkipIfNotSystemd(podmanTest.CgroupManager, "do not test --cgroups=split if not running on systemd")
+ SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users")
+ SkipIfRemote("--cgroups=split cannot be used in remote mode")
+
+ container := podmanTest.Podman([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"})
+ container.WaitWithDefaultTimeout()
+ Expect(container.ExitCode()).To(Equal(0))
+ lines := container.OutputToStringArray()
+
+ cgroup := ""
+ for _, line := range lines {
+ parts := strings.SplitN(line, ":", 3)
+ if !CGROUPSV2 {
+ // ignore unified on cgroup v1.
+ // both runc and crun do not set it.
+ // crun does not set named hierarchies.
+ if parts[1] == "" || strings.Contains(parts[1], "name=") {
+ continue
+ }
+ }
+ if parts[2] == "/" {
+ continue
+ }
+ if cgroup == "" {
+ cgroup = parts[2]
+ continue
+ }
+ Expect(cgroup).To(Equal(parts[2]))
+ }
+ })
+
It("podman run with cgroups=disabled runs without cgroups", func() {
SkipIfRootless("FIXME: I believe this should work but need to fix this test")
SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users")
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index 8d860cfc3..79ef707a2 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -7,7 +7,7 @@ import (
"os/user"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index bc89b59de..454dfdc83 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -2,13 +2,15 @@ package integration
import (
"fmt"
+ "io/ioutil"
"os"
"os/exec"
+ "os/user"
"path/filepath"
"strings"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
@@ -304,6 +306,48 @@ var _ = Describe("Podman run with volumes", func() {
Expect(separateVolumeSession.OutputToString()).To(Equal(baselineOutput))
})
+ It("podman named volume copyup symlink", func() {
+ imgName := "testimg"
+ dockerfile := `FROM alpine
+RUN touch /testfile
+RUN sh -c "cd /etc/apk && ln -s ../../testfile"`
+ podmanTest.BuildImage(dockerfile, imgName, "false")
+
+ baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", imgName, "ls", "/etc/apk/"})
+ baselineSession.WaitWithDefaultTimeout()
+ Expect(baselineSession.ExitCode()).To(Equal(0))
+ baselineOutput := baselineSession.OutputToString()
+
+ outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/etc/apk/", imgName, "ls", "/etc/apk/"})
+ outputSession.WaitWithDefaultTimeout()
+ Expect(outputSession.ExitCode()).To(Equal(0))
+ Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
+ })
+
+ It("podman named volume copyup empty directory", func() {
+ baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", ALPINE, "ls", "/srv"})
+ baselineSession.WaitWithDefaultTimeout()
+ Expect(baselineSession.ExitCode()).To(Equal(0))
+ baselineOutput := baselineSession.OutputToString()
+
+ outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/srv", ALPINE, "ls", "/srv"})
+ outputSession.WaitWithDefaultTimeout()
+ Expect(outputSession.ExitCode()).To(Equal(0))
+ Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
+ })
+
+ It("podman named volume copyup of /var", func() {
+ baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", fedoraMinimal, "ls", "/var"})
+ baselineSession.WaitWithDefaultTimeout()
+ Expect(baselineSession.ExitCode()).To(Equal(0))
+ baselineOutput := baselineSession.OutputToString()
+
+ outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/var", fedoraMinimal, "ls", "/var"})
+ outputSession.WaitWithDefaultTimeout()
+ Expect(outputSession.ExitCode()).To(Equal(0))
+ Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
+ })
+
It("podman read-only tmpfs conflict with volume", func() {
session := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "--read-only", "-v", "tmp_volume:" + dest, ALPINE, "touch", dest + "/a"})
session.WaitWithDefaultTimeout()
@@ -548,4 +592,55 @@ VOLUME /test/`
Expect(session.ExitCode()).To(Equal(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
})
+
+ It("podman run with U volume flag", func() {
+ SkipIfRemote("Overlay volumes only work locally")
+
+ u, err := user.Current()
+ Expect(err).To(BeNil())
+ name := u.Username
+ if name == "root" {
+ name = "containers"
+ }
+
+ content, err := ioutil.ReadFile("/etc/subuid")
+ if err != nil {
+ Skip("cannot read /etc/subuid")
+ }
+ if !strings.Contains(string(content), name) {
+ Skip("cannot find mappings for the current user")
+ }
+
+ if os.Getenv("container") != "" {
+ Skip("Overlay mounts not supported when running in a container")
+ }
+ if rootless.IsRootless() {
+ if _, err := exec.LookPath("fuse_overlay"); err != nil {
+ Skip("Fuse-Overlayfs required for rootless overlay mount test")
+ }
+ }
+
+ mountPath := filepath.Join(podmanTest.TempDir, "secrets")
+ os.Mkdir(mountPath, 0755)
+ vol := mountPath + ":" + dest + ":U"
+
+ session := podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ found, _ := session.GrepString("888:888")
+ Expect(found).Should(BeTrue())
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "auto", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ found, _ = session.GrepString("888:888")
+ Expect(found).Should(BeTrue())
+
+ vol = vol + ",O"
+ session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "keep-id", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ found, _ = session.GrepString("888:888")
+ Expect(found).Should(BeTrue())
+ })
})
diff --git a/test/e2e/run_working_dir_test.go b/test/e2e/run_working_dir_test.go
index 59538448e..2d16cdc18 100644
--- a/test/e2e/run_working_dir_test.go
+++ b/test/e2e/run_working_dir_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -47,7 +47,7 @@ var _ = Describe("Podman run", func() {
It("podman run a container on an image with a workdir", func() {
dockerfile := `FROM alpine
-RUN mkdir -p /home/foobar
+RUN mkdir -p /home/foobar /etc/foobar; chown bin:bin /etc/foobar
WORKDIR /etc/foobar`
podmanTest.BuildImage(dockerfile, "test", "false")
@@ -56,6 +56,10 @@ WORKDIR /etc/foobar`
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("/etc/foobar"))
+ session = podmanTest.Podman([]string{"run", "test", "ls", "-ld", "."})
+ session.WaitWithDefaultTimeout()
+ Expect(session.LineInOutputContains("bin")).To(BeTrue())
+
session = podmanTest.Podman([]string{"run", "--workdir", "/home/foobar", "test", "pwd"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go
index 10e16ea23..2eec15c62 100644
--- a/test/e2e/runlabel_test.go
+++ b/test/e2e/runlabel_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go
index a5737c110..5ddd5efc8 100644
--- a/test/e2e/save_test.go
+++ b/test/e2e/save_test.go
@@ -8,8 +8,8 @@ import (
"strconv"
"strings"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index 4a11802c3..8c388d0ee 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -9,7 +9,7 @@ import (
"strconv"
"text/template"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index 6dad605c5..fbee18442 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -5,7 +5,7 @@ import (
"os"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index a6f22e007..f527b67f6 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -95,6 +95,23 @@ var _ = Describe("Podman start", func() {
Expect(session.OutputToString()).To(Equal(shortID))
})
+ It("podman container start single container by short id", func() {
+ session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+ shortID := cid[0:10]
+ session = podmanTest.Podman([]string{"container", "start", shortID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal(shortID))
+
+ session = podmanTest.Podman([]string{"stop", shortID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal(shortID))
+ })
+
It("podman start single container by name", func() {
name := "foobar99"
session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"})
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index 53aa230e9..2218d72b5 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -8,7 +8,7 @@ import (
"strconv"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 750d38ffb..dd264eb0d 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -5,7 +5,7 @@ import (
"os"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -149,13 +149,12 @@ var _ = Describe("Podman stop", func() {
session := podmanTest.RunTopContainer("test4")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- cid1 := session.OutputToString()
session = podmanTest.Podman([]string{"stop", "--time", "1", "test4"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
output := session.OutputToString()
- Expect(output).To(ContainSubstring(cid1))
+ Expect(output).To(ContainSubstring("test4"))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
@@ -167,14 +166,13 @@ var _ = Describe("Podman stop", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test5", ALPINE, "sleep", "100"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- cid1 := session.OutputToString()
session = podmanTest.Podman([]string{"stop", "--timeout", "1", "test5"})
// Without timeout container stops in 10 seconds
// If not stopped in 5 seconds, then --timeout did not work
session.Wait(5)
Expect(session.ExitCode()).To(Equal(0))
output := session.OutputToString()
- Expect(output).To(ContainSubstring(cid1))
+ Expect(output).To(ContainSubstring("test5"))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go
index a23d50f29..4697cf860 100644
--- a/test/e2e/system_connection_test.go
+++ b/test/e2e/system_connection_test.go
@@ -6,7 +6,7 @@ import (
"os"
"github.com/containers/common/pkg/config"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go
index 050a01805..9daf3f8f9 100644
--- a/test/e2e/system_df_test.go
+++ b/test/e2e/system_df_test.go
@@ -6,7 +6,7 @@ import (
"strconv"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go
index e716ce4f3..fcfcdaf85 100644
--- a/test/e2e/system_reset_test.go
+++ b/test/e2e/system_reset_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 49ab3b8ed..b132750b0 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -6,7 +6,7 @@ import (
"strings"
"time"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go
index 8e8264e9d..83b6d023d 100644
--- a/test/e2e/tag_test.go
+++ b/test/e2e/tag_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go
index 6de775983..d605b59f9 100644
--- a/test/e2e/toolbox_test.go
+++ b/test/e2e/toolbox_test.go
@@ -35,8 +35,8 @@ import (
"strings"
"syscall"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go
index c182b88e6..d7105b17a 100644
--- a/test/e2e/top_test.go
+++ b/test/e2e/top_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/tree_test.go b/test/e2e/tree_test.go
index 9bdc3af9d..184b99dfb 100644
--- a/test/e2e/tree_test.go
+++ b/test/e2e/tree_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go
index 19e576490..ae7b987ae 100644
--- a/test/e2e/trust_test.go
+++ b/test/e2e/trust_test.go
@@ -6,7 +6,7 @@ import (
"os"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/unshare_test.go b/test/e2e/unshare_test.go
index 182a65775..515b3a42e 100644
--- a/test/e2e/unshare_test.go
+++ b/test/e2e/unshare_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go
index 4d4f60f0c..d0d271715 100644
--- a/test/e2e/untag_test.go
+++ b/test/e2e/untag_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go
index 903748b58..75986e671 100644
--- a/test/e2e/version_test.go
+++ b/test/e2e/version_test.go
@@ -4,8 +4,8 @@ import (
"fmt"
"os"
- . "github.com/containers/podman/v2/test/utils"
- "github.com/containers/podman/v2/version"
+ . "github.com/containers/podman/v3/test/utils"
+ "github.com/containers/podman/v3/version"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go
index 544532ee0..ab65146eb 100644
--- a/test/e2e/volume_create_test.go
+++ b/test/e2e/volume_create_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/volume_exists_test.go b/test/e2e/volume_exists_test.go
index 6073c6d90..edbeb2c69 100644
--- a/test/e2e/volume_exists_test.go
+++ b/test/e2e/volume_exists_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go
index 7ff1d63b4..05aaf1025 100644
--- a/test/e2e/volume_inspect_test.go
+++ b/test/e2e/volume_inspect_test.go
@@ -4,7 +4,7 @@ import (
"os"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go
index 5c466124d..cb5ecbcc3 100644
--- a/test/e2e/volume_ls_test.go
+++ b/test/e2e/volume_ls_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
diff --git a/test/e2e/volume_plugin_test.go b/test/e2e/volume_plugin_test.go
index 16edab27c..183050e8c 100644
--- a/test/e2e/volume_plugin_test.go
+++ b/test/e2e/volume_plugin_test.go
@@ -5,7 +5,7 @@ import (
"os"
"path/filepath"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go
index a910c47a7..1d4e64ec7 100644
--- a/test/e2e/volume_prune_test.go
+++ b/test/e2e/volume_prune_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go
index cdced1f13..883a503c4 100644
--- a/test/e2e/volume_rm_test.go
+++ b/test/e2e/volume_rm_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go
index 4f1e74977..71df28ca8 100644
--- a/test/e2e/wait_test.go
+++ b/test/e2e/wait_test.go
@@ -3,7 +3,7 @@ package integration
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/python/docker/test_containers.py b/test/python/docker/test_containers.py
index 5c2a5fef2..337cacd5c 100644
--- a/test/python/docker/test_containers.py
+++ b/test/python/docker/test_containers.py
@@ -86,6 +86,13 @@ class TestContainers(unittest.TestCase):
containers = self.client.containers.list(all=True)
self.assertEqual(len(containers), 2)
+ def test_start_container_with_random_port_bind(self):
+ container = self.client.containers.create(image=constant.ALPINE,
+ name="containerWithRandomBind",
+ ports={'1234/tcp': None})
+ containers = self.client.containers.list(all=True)
+ self.assertTrue(container in containers)
+
def test_stop_container(self):
top = self.client.containers.get(TestContainers.topContainerId)
self.assertEqual(top.status, "running")
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 3749dcac5..b2999a9e7 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -139,7 +139,7 @@ echo $rand | 0 | $rand
is "$output" "" "--pull=never [present]: no output"
# Now test with a remote image which we don't have present (the 00 tag)
- NONLOCAL_IMAGE="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:00000000"
+ NONLOCAL_IMAGE="$PODMAN_NONLOCAL_IMAGE_FQN"
run_podman 125 run --pull=never $NONLOCAL_IMAGE true
is "$output" "Error: unable to find a name and tag match for $NONLOCAL_IMAGE in repotags: no such image" "--pull=never [with image not present]: error"
@@ -175,7 +175,7 @@ echo $rand | 0 | $rand
# 'run --rmi' deletes the image in the end unless it's used by another container
@test "podman run --rmi" {
# Name of a nonlocal image. It should be pulled in by the first 'run'
- NONLOCAL_IMAGE="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:00000000"
+ NONLOCAL_IMAGE="$PODMAN_NONLOCAL_IMAGE_FQN"
run_podman 1 image exists $NONLOCAL_IMAGE
# Run a container, without --rm; this should block subsequent --rmi
@@ -662,4 +662,10 @@ json-file | f
run_podman rm $cname
}
+@test "podman run - do not set empty HOME" {
+ # Regression test for #9378.
+ run_podman run --rm --user 100 $IMAGE printenv
+ is "$output" ".*HOME=/.*"
+}
+
# vim: filetype=sh
diff --git a/test/system/055-rm.bats b/test/system/055-rm.bats
index 0107114b5..a5770f20f 100644
--- a/test/system/055-rm.bats
+++ b/test/system/055-rm.bats
@@ -51,6 +51,13 @@ load helpers
run_podman rm $rand $external_cid
}
+@test "podman rm <-> run --rm race" {
+ # A container's lock is released before attempting to stop it. This opens
+ # the window for race conditions that led to #9479.
+ run_podman run --rm -d $IMAGE sleep infinity
+ run_podman rm -af
+}
+
# I'm sorry! This test takes 13 seconds. There's not much I can do about it,
# please know that I think it's justified: podman 1.5.0 had a strange bug
# in with exit status was not preserved on some code paths with 'rm -f'
diff --git a/test/system/065-cp.bats b/test/system/065-cp.bats
index d3cf1c274..312106b36 100644
--- a/test/system/065-cp.bats
+++ b/test/system/065-cp.bats
@@ -18,6 +18,8 @@ load helpers
echo "${randomcontent[0]}" > $srcdir/hostfile0
echo "${randomcontent[1]}" > $srcdir/hostfile1
echo "${randomcontent[2]}" > $srcdir/hostfile2
+ mkdir -p $srcdir/subdir
+ echo "${randomcontent[2]}" > $srcdir/subdir/dotfile.
run_podman run -d --name cpcontainer --workdir=/srv $IMAGE sleep infinity
run_podman exec cpcontainer mkdir /srv/subdir
@@ -50,6 +52,11 @@ load helpers
is "$output" "${randomcontent[$id]}" "$description (cp -> ctr:$dest)"
done < <(parse_table "$tests")
+ # Dots are special for dirs not files.
+ run_podman cp $srcdir/subdir/dotfile. cpcontainer:/tmp
+ run_podman exec cpcontainer cat /tmp/dotfile.
+ is "$output" "${randomcontent[2]}" "$description (cp -> ctr:$dest)"
+
# Host path does not exist.
run_podman 125 cp $srcdir/IdoNotExist cpcontainer:/tmp
is "$output" 'Error: ".*/IdoNotExist" could not be found on the host' \
@@ -76,12 +83,14 @@ load helpers
)
run_podman run -d --name cpcontainer --workdir=/srv $IMAGE sleep infinity
run_podman exec cpcontainer sh -c "echo ${randomcontent[0]} > /tmp/containerfile"
+ run_podman exec cpcontainer sh -c "echo ${randomcontent[0]} > /tmp/dotfile."
run_podman exec cpcontainer sh -c "echo ${randomcontent[1]} > /srv/containerfile1"
run_podman exec cpcontainer sh -c "mkdir /srv/subdir; echo ${randomcontent[2]} > /srv/subdir/containerfile2"
# format is: <id> | <source arg to cp> | <destination arg (appended to $srcdir) to cp> | <full dest path (appended to $srcdir)> | <test name>
tests="
0 | /tmp/containerfile | | /containerfile | copy to srcdir/
+0 | /tmp/dotfile. | | /dotfile. | copy to srcdir/
0 | /tmp/containerfile | / | /containerfile | copy to srcdir/
0 | /tmp/containerfile | /. | /containerfile | copy to srcdir/.
0 | /tmp/containerfile | /newfile | /newfile | copy to srcdir/newfile
@@ -117,12 +126,18 @@ load helpers
echo "${randomcontent[0]}" > $srcdir/hostfile0
echo "${randomcontent[1]}" > $srcdir/hostfile1
+ # "." and "dir/." will copy the contents, so make sure that a dir ending
+ # with dot is treated correctly.
+ mkdir -p $srcdir.
+ cp $srcdir/* $srcdir./
+
run_podman run -d --name cpcontainer --workdir=/srv $IMAGE sleep infinity
run_podman exec cpcontainer mkdir /srv/subdir
# format is: <source arg to cp (appended to srcdir)> | <destination arg to cp> | <full dest path> | <test name>
tests="
| / | /dir-test | copy to root
+ . | / | /dir-test. | copy dotdir to root
/ | /tmp | /tmp/dir-test | copy to tmp
/. | /usr/ | /usr/ | copy contents of dir to usr/
| . | /srv/dir-test | copy to workdir (rel path)
@@ -153,6 +168,9 @@ load helpers
run_podman run -d --name cpcontainer --workdir=/srv $IMAGE sleep infinity
run_podman exec cpcontainer sh -c 'mkdir /srv/subdir; echo "This first file is on the container" > /srv/subdir/containerfile1'
run_podman exec cpcontainer sh -c 'echo "This second file is on the container as well" > /srv/subdir/containerfile2'
+ # "." and "dir/." will copy the contents, so make sure that a dir ending
+ # with dot is treated correctly.
+ run_podman exec cpcontainer sh -c 'mkdir /tmp/subdir.; cp /srv/subdir/* /tmp/subdir./'
run_podman cp cpcontainer:/srv $srcdir
run cat $srcdir/srv/subdir/containerfile1
@@ -174,6 +192,14 @@ load helpers
is "$output" "This first file is on the container"
run cat $srcdir/containerfile2
is "$output" "This second file is on the container as well"
+ rm -rf $srcdir/subdir
+
+ run_podman cp cpcontainer:/tmp/subdir. $srcdir
+ run cat $srcdir/subdir./containerfile1
+ is "$output" "This first file is on the container"
+ run cat $srcdir/subdir./containerfile2
+ is "$output" "This second file is on the container as well"
+ rm -rf $srcdir/subdir.
run_podman rm -f cpcontainer
}
@@ -449,9 +475,9 @@ load helpers
run_podman exec cpcontainer rm -rf /tmp/$srcdir
# Now for "/dev/stdin".
+ # Note: while this works, the content ends up in Nirvana.
+ # Same for Docker.
run_podman cp /dev/stdin cpcontainer:/tmp < $tar_file
- run_podman exec cpcontainer cat /tmp/$srcdir/$rand_filename
- is "$output" "$rand_content"
# Error checks below ...
@@ -461,11 +487,11 @@ load helpers
# Destination must be a directory (on an existing file).
run_podman exec cpcontainer touch /tmp/file.txt
- run_podman 125 cp /dev/stdin cpcontainer:/tmp/file.txt < $tar_file
+ run_podman 125 cp - cpcontainer:/tmp/file.txt < $tar_file
is "$output" 'Error: destination must be a directory when copying from stdin'
# Destination must be a directory (on an absent path).
- run_podman 125 cp /dev/stdin cpcontainer:/tmp/IdoNotExist < $tar_file
+ run_podman 125 cp - cpcontainer:/tmp/IdoNotExist < $tar_file
is "$output" 'Error: destination must be a directory when copying from stdin'
run_podman rm -f cpcontainer
@@ -482,6 +508,10 @@ load helpers
run_podman exec cpcontainer sh -c "echo '$rand_content' > /tmp/file.txt"
run_podman exec cpcontainer touch /tmp/empty.txt
+ # Make sure that only "-" gets special treatment. "/dev/stdout"
+ run_podman 125 cp cpcontainer:/tmp/file.txt /dev/stdout
+ is "$output" 'Error: invalid destination: "/dev/stdout" must be a directory or a regular file'
+
# Copying from stdout will always compress. So let's copy the previously
# created file from the container via stdout, untar the archive and make
# sure the file exists with the expected content.
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 7a42a4c18..1e7d366a1 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -46,6 +46,31 @@ EOF
is "$output" ".*invalidflag" "failed when passing undefined flags to the runtime"
}
+@test "podman build - set runtime" {
+ skip_if_remote "--runtime flag not supported for remote"
+ # Test on the CLI and via containers.conf
+
+ tmpdir=$PODMAN_TMPDIR/build-test
+ run mkdir -p $tmpdir
+ containerfile=$tmpdir/Containerfile
+ cat >$containerfile <<EOF
+FROM $IMAGE
+RUN echo $rand_content
+EOF
+
+ run_podman 125 --runtime=idonotexist build -t build_test $tmpdir
+ is "$output" ".*\"idonotexist\" not found.*" "failed when passing invalid OCI runtime via CLI"
+
+ containersconf=$tmpdir/containers.conf
+ cat >$containersconf <<EOF
+[engine]
+runtime="idonotexist"
+EOF
+
+ CONTAINERS_CONF="$containersconf" run_podman 125 build -t build_test $tmpdir
+ is "$output" ".*\"idonotexist\" not found.*" "failed when passing invalid OCI runtime via containers.conf"
+}
+
# Regression from v1.5.0. This test passes fine in v1.5.0, fails in 1.6
@test "podman build - cache (#3920)" {
# Make an empty test directory, with a subdirectory used for tar
@@ -280,8 +305,10 @@ Cmd[0] | /bin/mydefaultcmd
Cmd[1] | $s_echo
WorkingDir | $workdir
Labels.$label_name | $label_value
-Labels.\"io.buildah.version\" | $buildah_version
"
+ # FIXME: 2021-02-24: Fixed in buildah #3036; reenable this once podman
+ # vendors in a newer buildah!
+ # Labels.\"io.buildah.version\" | $buildah_version
parse_table "$tests" | while read field expect; do
actual=$(jq -r ".[0].Config.$field" <<<"$output")
@@ -453,6 +480,45 @@ EOF
run_podman rmi -a --force
}
+@test "build with copy-from referencing the base image" {
+ skip_if_rootless "cannot mount as rootless"
+ target=busybox-derived
+ target_mt=busybox-mt-derived
+ tmpdir=$PODMAN_TMPDIR/build-test
+ mkdir -p $tmpdir
+ containerfile1=$tmpdir/Containerfile1
+ cat >$containerfile1 <<EOF
+FROM quay.io/libpod/busybox AS build
+RUN rm -f /bin/paste
+USER 1001
+COPY --from=quay.io/libpod/busybox /bin/paste /test/
+EOF
+ containerfile2=$tmpdir/Containerfile2
+ cat >$containerfile2 <<EOF
+FROM quay.io/libpod/busybox AS test
+RUN rm -f /bin/nl
+FROM quay.io/libpod/alpine AS final
+COPY --from=quay.io/libpod/busybox /bin/nl /test/
+EOF
+ run_podman build -t ${target} -f ${containerfile1} ${tmpdir}
+ run_podman build --jobs 4 -t ${target} -f ${containerfile1} ${tmpdir}
+
+ run_podman build -t ${target} -f ${containerfile2} ${tmpdir}
+ run_podman build --no-cache --jobs 4 -t ${target_mt} -f ${containerfile2} ${tmpdir}
+
+ # (can only test locally; podman-remote has no image mount command)
+ if ! is_remote; then
+ run_podman image mount ${target}
+ root_single_job=$output
+
+ run_podman image mount ${target_mt}
+ root_multi_job=$output
+
+ # Check that both the version with --jobs 1 and --jobs=N have the same number of files
+ test $(find $root_single_job -type f | wc -l) = $(find $root_multi_job -type f | wc -l)
+ fi
+}
+
@test "podman build --logfile test" {
tmpdir=$PODMAN_TMPDIR/build-test
mkdir -p $tmpdir
diff --git a/test/system/600-completion.bats b/test/system/600-completion.bats
index 8cac2c9aa..fbb0da231 100644
--- a/test/system/600-completion.bats
+++ b/test/system/600-completion.bats
@@ -157,7 +157,17 @@ function check_shell_completion() {
# resume
;;&
- *PATH* | *CONTEXT* | *KUBEFILE* | *COMMAND* | *ARG...* | *URI*)
+ *SECRET*)
+ run_completion "$@" $cmd "${extra_args[@]}" ""
+ is "$output" ".*$random_secret_name${nl}" \
+ "$* $cmd: actual secret listed in suggestions"
+ _check_completion_end NoFileComp
+
+ match=true
+ # resume
+ ;;&
+
+ *PATH* | *CONTEXT* | *FILE* | *COMMAND* | *ARG...* | *URI*)
# default shell completion should be done for everything which accepts a path
run_completion "$@" $cmd "${extra_args[@]}" ""
@@ -232,6 +242,11 @@ function _check_completion_end() {
random_image_tag=$(random_string 5)
random_network_name=$(random_string 30)
random_volume_name=$(random_string 30)
+ random_secret_name=$(random_string 30)
+ random_secret_content=$(random_string 30)
+ secret_file=$PODMAN_TMPDIR/$(random_string 10)
+
+ echo $random_secret_content > $secret_file
# create a container for each state since some commands are only suggesting running container for example
run_podman create --name created-$random_container_name $IMAGE
@@ -263,6 +278,8 @@ function _check_completion_end() {
# create volume
run_podman volume create $random_volume_name
+ # create secret
+ run_podman secret create $random_secret_name $secret_file
# $PODMAN may be a space-separated string, e.g. if we include a --url.
local -a podman_as_array=($PODMAN)
@@ -274,6 +291,9 @@ function _check_completion_end() {
check_shell_completion
# cleanup
+ run_podman secret rm $random_secret_name
+ rm -f $secret_file
+
run_podman volume rm $random_volume_name
run_podman network rm $random_network_name
diff --git a/test/e2e/test.yaml b/test/system/700-play.bats
index 98d2c91df..e7904f59f 100644
--- a/test/e2e/test.yaml
+++ b/test/system/700-play.bats
@@ -1,13 +1,17 @@
-# Save the output of this file and use kubectl create -f to import
-# it into Kubernetes.
+#!/usr/bin/env bats -*- bats -*-
#
-# Created with podman-1.6.2
+# Test podman play
+#
+
+load helpers
+
+testYaml="
apiVersion: v1
kind: Pod
metadata:
labels:
app: test
- name: test
+ name: test_pod
spec:
containers:
- command:
@@ -20,7 +24,7 @@ spec:
value: xterm
- name: container
value: podman
- image: docker.io/library/fedora:latest
+ image: quay.io/libpod/alpine:latest
name: test
resources: {}
securityContext:
@@ -31,7 +35,20 @@ spec:
capabilities: {}
privileged: false
seLinuxOptions:
- level: "s0:c1,c2"
+ level: "s0:c1,c2"
readOnlyRootFilesystem: false
workingDir: /
status: {}
+"
+
+@test "podman play with stdin" {
+ echo "$testYaml" > $PODMAN_TMPDIR/test.yaml
+ run_podman play kube - < $PODMAN_TMPDIR/test.yaml
+ run_podman pod rm -f test_pod
+}
+
+@test "podman play" {
+ echo "$testYaml" > $PODMAN_TMPDIR/test.yaml
+ run_podman play kube $PODMAN_TMPDIR/test.yaml
+ run_podman pod rm -f test_pod
+}
diff --git a/test/system/build-testimage b/test/system/build-testimage
index 53ade57f0..aac08e307 100755
--- a/test/system/build-testimage
+++ b/test/system/build-testimage
@@ -12,6 +12,9 @@
# still need a fedora image for that.
#
+# Buildah binary
+BUILDAH=${BUILDAH:-buildah}
+
# Tag for this new image
YMD=$(date +%Y%m%d)
@@ -58,7 +61,8 @@ chmod 755 pause
# - check for updates @ https://hub.docker.com/_/alpine
# busybox-extras provides httpd needed in 500-networking.bats
cat >Containerfile <<EOF
-FROM docker.io/library/alpine:3.12.0
+ARG ARCH=please-override-arch
+FROM docker.io/\${ARCH}/alpine:3.12.0
RUN apk add busybox-extras
ADD testimage-id pause /home/podman/
LABEL created_by=$create_script
@@ -69,26 +73,44 @@ EOF
# --squash-all : needed by 'tree' test in 070-build.bats
podman rmi -f testimage &> /dev/null || true
-podman build --squash-all -t testimage .
+
+# We need to use buildah because (as of 2021-02-23) only buildah has --manifest
+# and because Dan says arch emulation is not currently working on podman
+# (no further details).
+# Arch emulation on Fedora requires the qemu-user-static package.
+for arch in amd64 ppc64le s390x;do
+ ${BUILDAH} bud \
+ --arch=$arch \
+ --build-arg ARCH=$arch \
+ --manifest=testimage \
+ --squash \
+ .
+done
# Clean up
cd /tmp
rm -rf $tmpdir
-# Tag and push to quay.
-podman tag testimage quay.io/libpod/testimage:$YMD
-podman push quay.io/libpod/testimage:$YMD
+# Tag image and push (all arches) to quay.
+remote_tag=quay.io/libpod/testimage:$YMD
+podman tag testimage ${remote_tag}
+${BUILDAH} manifest push --all ${remote_tag} docker://${remote_tag}
-# Side note: there should always be a testimage tagged ':00000000'
-# (eight zeroes) in the same location; this is used by tests which
-# need to pull a non-locally-cached image. This image will rarely
-# if ever need to change, nor in fact does it even have to be a
-# copy of this testimage since all we use it for is 'true'.
+# Side note: there should always be a testimage tagged ':0000000<X>'
+# (eight digits, zero-padded sequence ID) in the same location; this is
+# used by tests which need to pull a non-locally-cached image. This
+# image will rarely if ever need to change, nor in fact does it even
+# have to be a copy of this testimage since all we use it for is 'true'.
+# However, it does need to be multiarch :-(
#
-# As of 2020-09-02 it is simply busybox, because it is super small:
+# As of 2021-02-24 it is simply busybox, because it is super small,
+# but it's complicated because of multiarch:
#
-# podman pull docker.io/library/busybox:1.32.0
-# podman tag docker.io/library/busybox:1.32.0 \
-# quay.io/libpod/testimage:00000000
-# podman push quay.io/libpod/testimage:00000000
+# img=quay.io/libpod/testimage:00000001
+# buildah manifest create $img
+# for arch in amd64 ppc64le s390x;do
+# buildah pull --arch $arch docker.io/$arch/busybox:1.32.0
+# buildah manifest add $img docker.io/$arch/busybox:1.32.0
+# done
+# buildah manifest push --all $img docker://$img
#
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 0572c6866..38e317709 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -7,9 +7,14 @@ 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:-"20200929"}
+PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20210223"}
PODMAN_TEST_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG"
+# Remote image that we *DO NOT* fetch or keep by default; used for testing pull
+# This changed from 0 to 1 on 2021-02-24 due to multiarch considerations; it
+# should change only very rarely.
+PODMAN_NONLOCAL_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:00000001"
+
# Because who wants to spell that out each time?
IMAGE=$PODMAN_TEST_IMAGE_FQN
@@ -149,7 +154,7 @@ function run_podman() {
echo "$_LOG_PROMPT $PODMAN $*"
# BATS hangs if a subprocess remains and keeps FD 3 open; this happens
# if podman crashes unexpectedly without cleaning up subprocesses.
- run timeout --foreground -v --kill=10 $PODMAN_TIMEOUT $PODMAN "$@" 3>/dev/null
+ run timeout --foreground -v --kill=10 $PODMAN_TIMEOUT $PODMAN $_PODMAN_TEST_OPTS "$@" 3>/dev/null
# without "quotes", multiple lines are glommed together into one
if [ -n "$output" ]; then
echo "$output"
diff --git a/test/upgrade/README.md b/test/upgrade/README.md
new file mode 100644
index 000000000..2979a66d7
--- /dev/null
+++ b/test/upgrade/README.md
@@ -0,0 +1,87 @@
+Background
+==========
+
+For years we've been needing a way to test podman upgrades; this
+became much more critical on December 7, 2020, when Matt disclosed
+a bug he had found over the weekend
+([#8613](https://github.com/containers/podman/issues/8613))
+in which reuse of a previously-defined field name would
+result in fatal JSON decode failures if current-podman were
+to try reading containers created with podman <= 1.8 (FIXME: confirm)
+
+Upgrade testing is a daunting problem; but in the December 12
+Cabal meeting Dan suggested using podman-in-podman. This PR
+is the result of fleshing out that idea.
+
+Overview
+========
+
+The BATS script in this directory fetches and runs an old-podman
+container image from quay.io/podman, uses it to create and run
+a number of containers, then uses new-podman to interact with
+those containers.
+
+As of 2021-02-23 the available old-podman versions are:
+
+```console
+$ ./bin/podman search --list-tags quay.io/podman/stable | awk '$2 ~ /^v/ { print $2}' | sort | column -c 75
+v1.4.2 v1.5.0 v1.6 v1.9.0 v2.0.2 v2.1.1
+v1.4.4 v1.5.1 v1.6.2 v1.9.1 v2.0.6 v2.2.1
+```
+
+Test invocation is:
+```console
+$ sudo env PODMAN=bin/podman PODMAN_UPGRADE_FROM=v1.9.0 PODMAN_UPGRADE_TEST_DEBUG= bats test/upgrade
+```
+(Path assumes you're cd'ed to top-level podman repo). `PODMAN_UPGRADE_FROM`
+can be any of the versions above. `PODMAN_UPGRADE_TEST_DEBUG` is empty
+here, but listed so you can set it `=1` and leave the podman_parent
+container running. Interacting with this container is left as an
+exercise for the reader.
+
+The script will pull the given podman image, invoke it with a scratch
+root directory, and have it do a small set of podman stuff (pull an
+image, create/run some containers). This podman process stays running
+because if it exits, it kills containers running inside the container.
+
+We then invoke the current (host-installed) podman, using the same
+scratch root directory, and perform operations on those images and
+containers. Most of those operations are done in individual @tests.
+
+The goal is to have this upgrade test run in CI, iterating over a
+loop of known old versions. This list would need to be hand-maintained
+and updated on new releases. There might also need to be extra
+configuration defined, such as per-version commands (see below).
+
+Findings
+========
+
+Well, first, `v1.6.2` won't work on default f32/f33: the image
+does not include `crun`, so it can't work at all:
+
+ ERRO[0000] oci runtime "runc" does not support CGroups V2: use system migrate to mitigate
+
+I realize that it's kind of stupid not to test 1.6, since that's
+precisely the test that would've caught #8613 early, but I just
+don't think it's worth the hassle of setting up cgroupsv1 VMs.
+
+For posterity, in an earlier incantation of this script I tried
+booting f32 into cgroupsv1 and ran into the following warnings
+when running new-podman on old-containers:
+```
+ERRO[0000] error joining network namespace for container 322b66d94640e31b2e6921565445cf0dade4ec13cabc16ee5f29292bdc038341: error retrieving network namespace at /var/run/netns/cni-577e2289-2c05-2e28-3c3d-002a5596e7da: failed to Statfs "/var/run/netns/cni-577e2289
+```
+
+Where To Go From Here
+=====================
+
+* Tests are still (2021-02-23) incomplete, with several failing outright.
+ See FIXMEs in the code.
+
+* Figuring out how/if to run rootless. I think this is possible, perhaps
+ even necessary, but will be tricky to get right because of home-directory
+ mounting.
+
+* Figuring out how/if to run variations with different config files
+ (e.g. running OLD-PODMAN that creates a user libpod.conf, tweaking
+ that in the test, then running NEW-PODMAN upgrate tests)
diff --git a/test/upgrade/helpers.bash b/test/upgrade/helpers.bash
new file mode 100644
index 000000000..41d9279e6
--- /dev/null
+++ b/test/upgrade/helpers.bash
@@ -0,0 +1,11 @@
+# -*- bash -*-
+
+load "../system/helpers"
+
+setup() {
+ :
+}
+
+teardown() {
+ :
+}
diff --git a/test/upgrade/test-upgrade.bats b/test/upgrade/test-upgrade.bats
new file mode 100644
index 000000000..dd827b398
--- /dev/null
+++ b/test/upgrade/test-upgrade.bats
@@ -0,0 +1,313 @@
+# -*- bats -*-
+
+load helpers
+
+# Create a var-lib-containers dir for this podman. We need to bind-mount
+# this into the container, and use --root and --runroot and --tmpdir
+# options both in the container podman and out here: that's the only
+# way to share image and container storage.
+if [ -z "${PODMAN_UPGRADE_WORKDIR}" ]; then
+ # Much as I'd love a descriptive name like "podman-upgrade-tests.XXXXX",
+ # keep it short ("pu") because of the 100-character path length limit
+ # for UNIX sockets (needed by conmon)
+ export PODMAN_UPGRADE_WORKDIR=$(mktemp -d --tmpdir=${BATS_TMPDIR:-${TMPDIR:-/tmp}} pu.XXXXXX)
+
+ touch $PODMAN_UPGRADE_WORKDIR/status
+fi
+
+# Generate a set of random strings used for content verification
+if [ -z "${RANDOM_STRING_1}" ]; then
+ export RANDOM_STRING_1=$(random_string 15)
+ export LABEL_CREATED=$(random_string 16)
+ export LABEL_FAILED=$(random_string 17)
+ export LABEL_RUNNING=$(random_string 18)
+
+ # FIXME: randomize this
+ HOST_PORT=34567
+fi
+
+# Version string of the podman we're actually testing, e.g. '3.0.0-dev-d1a26013'
+PODMAN_VERSION=$($PODMAN version |awk '/^Version:/ { V=$2 } /^Git Commit:/ { G=$3 } END { print V "-" substr(G,0,8) }')
+
+setup() {
+ skip_if_rootless
+
+ # The podman-in-podman image (old podman)
+ if [[ -z "$PODMAN_UPGRADE_FROM" ]]; then
+ echo "# \$PODMAN_UPGRADE_FROM is undefined (should be e.g. v1.9.0)" >&3
+ false
+ fi
+
+ if [ "$(< $PODMAN_UPGRADE_WORKDIR/status)" = "failed" ]; then
+ # FIXME: exit instead?
+ echo "*** setup failed - no point in running tests"
+ false
+ fi
+
+ export _PODMAN_TEST_OPTS="--root=$PODMAN_UPGRADE_WORKDIR/root --runroot=$PODMAN_UPGRADE_WORKDIR/runroot --tmpdir=$PODMAN_UPGRADE_WORKDIR/tmp"
+}
+
+###############################################################################
+# BEGIN setup
+
+@test "initial setup: start $PODMAN_UPGRADE_FROM containers" {
+ echo failed >| $PODMAN_UPGRADE_WORKDIR/status
+
+ OLD_PODMAN=quay.io/podman/stable:$PODMAN_UPGRADE_FROM
+ $PODMAN pull $OLD_PODMAN
+
+ # Shortcut name, because we're referencing it a lot
+ pmroot=$PODMAN_UPGRADE_WORKDIR
+
+ # WWW content to share
+ mkdir -p $pmroot/var/www
+ echo $RANDOM_STRING_1 >$pmroot/var/www/index.txt
+
+ # podman tmpdir
+ mkdir -p $pmroot/tmp
+
+ #
+ # Script to run >>OLD<< podman commands.
+ #
+ # These commands will be run inside a podman container. The "podman"
+ # command in this script will be the desired old-podman version.
+ #
+ pmscript=$pmroot/setup
+ cat >| $pmscript <<EOF
+#!/bin/bash
+
+# cgroup-manager=systemd does not work inside a container
+opts="--cgroup-manager=cgroupfs --events-backend=file $_PODMAN_TEST_OPTS"
+
+set -ex
+
+# Try try again, because network flakiness makes this a point of failure
+podman \$opts pull $IMAGE \
+ || (sleep 10; podman \$opts pull $IMAGE) \
+ || (sleep 30; podman \$opts pull $IMAGE)
+
+
+podman \$opts create --name mycreatedcontainer --label mylabel=$LABEL_CREATED \
+ $IMAGE false
+
+podman \$opts run --name mydonecontainer $IMAGE echo ++$RANDOM_STRING_1++
+
+podman \$opts run --name myfailedcontainer --label mylabel=$LABEL_FAILED \
+ $IMAGE sh -c 'exit 17' || true
+
+# FIXME: add "-p $HOST_PORT:80"
+# ...I tried and tried, and could not get this to work. I could never
+# connect to the port from the host, nor even from the podman_parent
+# container; I could never see the port listed in 'ps' nor 'inspect'.
+# And, finally, I ended up in a state where the container wouldn't
+# even start, and via complicated 'podman logs' found out:
+# httpd: bind: Address in use
+# So I just give up for now.
+#
+podman \$opts run -d --name myrunningcontainer --label mylabel=$LABEL_RUNNING \
+ -v $pmroot/var/www:/var/www \
+ -w /var/www \
+ $IMAGE /bin/busybox-extras httpd -f -p 80
+
+echo READY
+while :;do
+ if [ -e /stop ]; then
+ echo STOPPING
+ podman \$opts stop -t 0 myrunningcontainer || true
+ podman \$opts rm -f myrunningcontainer || true
+ exit 0
+ fi
+ sleep 0.5
+done
+EOF
+ chmod 555 $pmscript
+
+ # Clean up vestiges of previous run
+ $PODMAN rm -f podman_parent || true
+
+ # Not entirely a NOP! This is just so we get /run/crun created on a CI VM
+ $PODMAN run --rm $OLD_PODMAN true
+
+ #
+ # Use new-podman to run the above script under old-podman.
+ #
+ # DO NOT USE run_podman HERE! That would use $_PODMAN_TEST_OPTS
+ # and would write into our shared test dir, which would then
+ # pollute it for use by old-podman. We must keep that pristine
+ # so old-podman is the first to write to it.
+ #
+ $PODMAN run -d --name podman_parent --pid=host \
+ --privileged \
+ --net=host \
+ --cgroupns=host \
+ -v /dev/fuse:/dev/fuse \
+ -v /run/crun:/run/crun \
+ -v $pmroot:$pmroot \
+ $OLD_PODMAN $pmroot/setup
+
+ _PODMAN_TEST_OPTS= wait_for_ready podman_parent
+
+ echo OK >| $PODMAN_UPGRADE_WORKDIR/status
+}
+
+# END setup
+###############################################################################
+# BEGIN actual tests
+
+# This is a NOP; used only so the version string will show up in logs
+@test "upgrade: $PODMAN_UPGRADE_FROM -> $PODMAN_VERSION" {
+ :
+}
+
+@test "images" {
+ run_podman images -a --format '{{.Names}}'
+ is "$output" "\[$IMAGE\]" "podman images"
+}
+
+@test "ps : one container running" {
+ run_podman ps --format '{{.Image}}--{{.Names}}'
+ is "$output" "$IMAGE--myrunningcontainer" "ps: one container running"
+}
+
+@test "ps -a : shows all containers" {
+ # IMPORTANT: we can't use --sort=created, because that requires #8427
+ # on the *creating* podman end.
+ run_podman ps -a \
+ --format '{{.Names}}--{{.Status}}--{{.Ports}}--{{.Labels.mylabel}}' \
+ --sort=names
+ is "${lines[0]}" "mycreatedcontainer--Created----$LABEL_CREATED" "created"
+ is "${lines[1]}" "mydonecontainer--Exited (0).*----<no value>" "done"
+ is "${lines[2]}" "myfailedcontainer--Exited (17) .*----$LABEL_FAILED" "fail"
+ is "${lines[3]}" "myrunningcontainer--Up .*----$LABEL_RUNNING" "running"
+
+ # For debugging: dump containers and IDs
+ if [[ -n "$PODMAN_UPGRADE_TEST_DEBUG" ]]; then
+ run_podman ps -a
+ for l in "${lines[@]}"; do
+ echo "# $l" >&3
+ done
+ fi
+}
+
+
+@test "inspect - all container status" {
+ tests="
+running | running | 0
+created | configured | 0
+done | exited | 0
+failed | exited | 17
+"
+ while read cname state exitstatus; do
+ run_podman inspect --format '{{.State.Status}}--{{.State.ExitCode}}' my${cname}container
+ is "$output" "$state--$exitstatus" "status of my${cname}container"
+ done < <(parse_table "$tests")
+}
+
+@test "logs" {
+ run_podman logs mydonecontainer
+ is "$output" "++$RANDOM_STRING_1++" "podman logs on stopped container"
+
+# run_podman logs myrunningcontainer
+# is "$output" "READY" "podman logs on running container"
+}
+
+@test "exec" {
+ run_podman exec myrunningcontainer cat /var/www/index.txt
+ is "$output" "$RANDOM_STRING_1" "exec into myrunningcontainer"
+}
+
+@test "load" {
+ # FIXME, is this really necessary?
+ skip "TBI. Not sure if there's any point to this."
+}
+
+@test "mount" {
+ skip "TBI"
+}
+
+@test "pods" {
+ skip "TBI"
+}
+
+# FIXME: commit? kill? network? pause? restart? top? volumes? What else?
+
+
+@test "start" {
+ skip "FIXME: this leaves a mount behind: root/overlay/sha/merged"
+ run_podman --cgroup-manager=cgroupfs start -a mydonecontainer
+ is "$output" "++$RANDOM_STRING_1++" "start on already-run container"
+}
+
+@test "rm a stopped container" {
+ # FIXME FIXME FIXME!
+ #
+ # I have no idea what's going on here. For most of my testing in this
+ # section, the code here was simply 'podman rm myfailedcontainer', and
+ # it would succeed, but then way down, in 'cleanup' below, the 'rm -f'
+ # step would fail:
+ #
+ # # podman rm -f podman_parent
+ # error freeing lock for container <sha>: no such file or directory
+ # ...where <sha> is the ID of the podman_parent container.
+ #
+ # I started playing with this section, by adding 'rm mydonecontainer',
+ # and now it always fails, the same way, but with the container we're
+ # removing right here:
+ #
+ # error freeing lock for container <sha>: no such file or directory
+ # ...where <sha> is the ID of mydonecontainer.
+ #
+ # I don't know. I give up for now, and am skip'ing the whole thing.
+ # If you want to play with it, try commenting out the 'myfailed' lines,
+ # or just the 'mydone' ones, or, I don't know.
+ skip "FIXME: error freeing lock for container <sha>: no such file or dir"
+
+ # For debugging, so we can see what 'error freeing lock' refers to
+ run_podman ps -a
+
+ run_podman rm myfailedcontainer
+ is "$output" "[0-9a-f]\\{64\\}" "podman rm myfailedcontainer"
+
+ run_podman rm mydonecontainer
+ is "$output" "[0-9a-f]\\{64\\}" "podman rm mydonecontainer"
+}
+
+
+@test "stop and rm" {
+ # About a ten-second pause, then:
+ # Error: timed out waiting for file /tmp/pu.nf747w/tmp/exits/<sha>: internal libpod error
+ # It doesn't seem to be a socket-length issue: the paths are ~80-88 chars.
+ # Leaving podman_parent running, and exec'ing into it, it doesn't look
+ # like the file is being written to the wrong place.
+ skip "FIXME: this doesn't work: timed out waiting for file tmpdir/exits/sha"
+ run_podman stop myrunningcontainer
+ run_podman rm myrunningcontainer
+}
+
+@test "clean up parent" {
+ if [[ -n "$PODMAN_UPGRADE_TEST_DEBUG" ]]; then
+ skip "workdir is $PODMAN_UPGRADE_WORKDIR"
+ fi
+
+ # We're done with shared environment. By clearing this, we can now
+ # use run_podman for actions on the podman_parent container
+ unset _PODMAN_TEST_OPTS
+
+ # (Useful for debugging the 'rm -f' step below, which, when it fails, only
+ # gives a container ID. This 'ps' confirms that the CID is podman_parent)
+ run_podman ps -a
+
+ # Stop the container gracefully
+ run_podman exec podman_parent touch /stop
+ run_podman wait podman_parent
+
+ run_podman logs podman_parent
+ run_podman rm -f podman_parent
+
+ # FIXME: why does this remain mounted?
+ umount $PODMAN_UPGRADE_WORKDIR/root/overlay || true
+
+ rm -rf $PODMAN_UPGRADE_WORKDIR
+}
+
+# FIXME: now clean up
diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go
index 2f9e6f2c7..003d490ce 100644
--- a/test/utils/common_function_test.go
+++ b/test/utils/common_function_test.go
@@ -8,7 +8,7 @@ import (
"reflect"
"strings"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
diff --git a/test/utils/podmansession_test.go b/test/utils/podmansession_test.go
index 763cb4f26..d85f27bbb 100644
--- a/test/utils/podmansession_test.go
+++ b/test/utils/podmansession_test.go
@@ -1,7 +1,7 @@
package utils_test
import (
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/utils/podmantest_test.go b/test/utils/podmantest_test.go
index 538d55d8d..9bd1c4a66 100644
--- a/test/utils/podmantest_test.go
+++ b/test/utils/podmantest_test.go
@@ -3,7 +3,7 @@ package utils_test
import (
"os"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 6790f31cd..80af7fb7c 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -482,3 +482,13 @@ func RandomString(n int) string {
}
return string(b)
}
+
+//SkipIfInContainer skips a test if the test is run inside a container
+func SkipIfInContainer(reason string) {
+ if len(reason) < 5 {
+ panic("SkipIfInContainer must specify a reason to skip")
+ }
+ if os.Getenv("TEST_ENVIRON") == "container" {
+ Skip("[container]: " + reason)
+ }
+}
diff --git a/test/utils/utils_suite_test.go b/test/utils/utils_suite_test.go
index 01549f06e..d5f9cbce4 100644
--- a/test/utils/utils_suite_test.go
+++ b/test/utils/utils_suite_test.go
@@ -7,7 +7,7 @@ import (
"strings"
"testing"
- . "github.com/containers/podman/v2/test/utils"
+ . "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"