summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/common_test.go15
-rw-r--r--test/e2e/pod_create_test.go18
-rw-r--r--test/e2e/run_networking_test.go15
-rw-r--r--test/e2e/search_test.go23
-rw-r--r--test/endpoint/setup.go9
-rw-r--r--test/system/030-run.bats13
-rw-r--r--test/system/helpers.bash10
7 files changed, 84 insertions, 19 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index e36c86690..206c66f9f 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -235,14 +235,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
ociRuntime := os.Getenv("OCI_RUNTIME")
if ociRuntime == "" {
- var err error
- ociRuntime, err = exec.LookPath("crun")
- // If we cannot find the crun binary, setting to something static as we have no way
- // to return an error. The tests will fail and point out that the runc binary could
- // not be found nicely.
- if err != nil {
- ociRuntime = "/usr/bin/runc"
- }
+ ociRuntime = "crun"
}
os.Setenv("DISABLE_HC_SYSTEMD", "true")
CNIConfigDir := "/etc/cni/net.d"
@@ -673,3 +666,9 @@ func (p *PodmanTestIntegration) PodmanAsUser(args []string, uid, gid uint32, cwd
podmanSession := p.PodmanAsUserBase(args, uid, gid, cwd, env, false, false, nil)
return &PodmanSessionIntegration{podmanSession}
}
+
+// We don't support running Varlink when local
+func (p *PodmanTestIntegration) RestartRemoteService() {
+ p.StopRemoteService()
+ p.StartRemoteService()
+}
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index f69b6ca7b..83a66d2b9 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -245,6 +245,24 @@ var _ = Describe("Podman pod create", func() {
}
})
+ It("podman container in pod with IP address shares IP address", func() {
+ SkipIfRootless("Rootless does not support --ip")
+ podName := "test"
+ ctrName := "testCtr"
+ ip := GetRandomIPAddress()
+ podCreate := podmanTest.Podman([]string{"pod", "create", "--ip", ip, "--name", podName})
+ podCreate.WaitWithDefaultTimeout()
+ Expect(podCreate.ExitCode()).To(Equal(0))
+ podCtr := podmanTest.Podman([]string{"run", "--name", ctrName, "--pod", podName, "-d", "-t", ALPINE, "top"})
+ podCtr.WaitWithDefaultTimeout()
+ Expect(podCtr.ExitCode()).To(Equal(0))
+ ctrInspect := podmanTest.Podman([]string{"inspect", ctrName})
+ ctrInspect.WaitWithDefaultTimeout()
+ Expect(ctrInspect.ExitCode()).To(Equal(0))
+ ctrJSON := ctrInspect.InspectContainerToJSON()
+ Expect(ctrJSON[0].NetworkSettings.IPAddress).To(Equal(ip))
+ })
+
It("podman create pod with IP address and no infra should fail", func() {
name := "test"
ip := GetRandomIPAddress()
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index e14482db7..540ac5409 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -571,4 +571,19 @@ var _ = Describe("Podman run networking", func() {
podrm.WaitWithDefaultTimeout()
Expect(podrm.ExitCode()).To(BeZero())
})
+
+ It("podman run net=host adds entry to /etc/hosts", func() {
+ run := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/etc/hosts"})
+ run.WaitWithDefaultTimeout()
+ Expect(run.ExitCode()).To(BeZero())
+ Expect(strings.Contains(run.OutputToString(), "127.0.1.1")).To(BeTrue())
+ })
+
+ It("podman run with --net=host and --hostname sets correct hostname", func() {
+ hostname := "testctr"
+ run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"})
+ run.WaitWithDefaultTimeout()
+ Expect(run.ExitCode()).To(BeZero())
+ Expect(strings.Contains(run.OutputToString(), "testctr")).To(BeTrue())
+ })
})
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index 0cf005529..4f2751099 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -237,7 +237,6 @@ registries = ['{{.Host}}:{{.Port}}']`
})
It("podman search attempts HTTP if registry is in registries.insecure and force secure is false", func() {
- SkipIfRemote("--tls-verify is not supported on podman-remote search")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -264,6 +263,10 @@ registries = ['{{.Host}}:{{.Port}}']`
registryFileTmpl.Execute(&buffer, registryEndpoints[4])
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
ioutil.WriteFile(fmt.Sprintf("%s/registry4.conf", tempdir), buffer.Bytes(), 0644)
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ defer podmanTest.RestartRemoteService()
+ }
search := podmanTest.PodmanNoCache([]string{"search", image})
search.WaitWithDefaultTimeout()
@@ -278,7 +281,7 @@ registries = ['{{.Host}}:{{.Port}}']`
})
It("podman search doesn't attempt HTTP if force secure is true", func() {
- SkipIfRemote("--tls-verify is not supported on podman-remote search")
+ SkipIfRemote("FIXME This should work on podman-remote")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -303,6 +306,10 @@ registries = ['{{.Host}}:{{.Port}}']`
registryFileTmpl.Execute(&buffer, registryEndpoints[5])
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
ioutil.WriteFile(fmt.Sprintf("%s/registry5.conf", tempdir), buffer.Bytes(), 0644)
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ defer podmanTest.RestartRemoteService()
+ }
search := podmanTest.PodmanNoCache([]string{"search", image, "--tls-verify=true"})
search.WaitWithDefaultTimeout()
@@ -317,7 +324,7 @@ registries = ['{{.Host}}:{{.Port}}']`
})
It("podman search doesn't attempt HTTP if registry is not listed as insecure", func() {
- SkipIfRemote("--tls-verify is not supported on podman-remote search")
+ SkipIfRemote("FIXME This should work on podman-remote")
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -343,6 +350,11 @@ registries = ['{{.Host}}:{{.Port}}']`
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
ioutil.WriteFile(fmt.Sprintf("%s/registry6.conf", tempdir), buffer.Bytes(), 0644)
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ defer podmanTest.RestartRemoteService()
+ }
+
search := podmanTest.PodmanNoCache([]string{"search", image})
search.WaitWithDefaultTimeout()
@@ -393,6 +405,11 @@ registries = ['{{.Host}}:{{.Port}}']`
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
ioutil.WriteFile(fmt.Sprintf("%s/registry8.conf", tempdir), buffer.Bytes(), 0644)
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ defer podmanTest.RestartRemoteService()
+ }
+
search := podmanTest.PodmanNoCache([]string{"search", "my-alpine"})
search.WaitWithDefaultTimeout()
diff --git a/test/endpoint/setup.go b/test/endpoint/setup.go
index 56cab06b0..6bbc8d2bc 100644
--- a/test/endpoint/setup.go
+++ b/test/endpoint/setup.go
@@ -51,14 +51,7 @@ func Setup(tempDir string) *EndpointTestIntegration {
ociRuntime := os.Getenv("OCI_RUNTIME")
if ociRuntime == "" {
- var err error
- ociRuntime, err = exec.LookPath("runc")
- // If we cannot find the runc binary, setting to something static as we have no way
- // to return an error. The tests will fail and point out that the runc binary could
- // not be found nicely.
- if err != nil {
- ociRuntime = "/usr/bin/runc"
- }
+ ociRuntime = "runc"
}
os.Setenv("DISABLE_HC_SYSTEMD", "true")
CNIConfigDir := "/etc/cni/net.d"
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 28dc7c7a7..9f4037730 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -460,4 +460,17 @@ json-file | f
is "$output" "$expect" "podman run with --tz=local, matches host"
}
+# run with --runtime should preserve the named runtime
+@test "podman run : full path to --runtime is preserved" {
+ skip_if_cgroupsv1
+ skip_if_remote
+ run_podman run -d --runtime '/usr/bin/crun' $IMAGE sleep 60
+ cid="$output"
+
+ run_podman inspect --format '{{.OCIRuntime}}' $cid
+ is "$output" "/usr/bin/crun"
+
+ run_podman kill $cid
+}
+
# vim: filetype=sh
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 73cf1e5b2..2cced10c2 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -253,6 +253,7 @@ function is_cgroupsv1() {
! is_cgroupsv2
}
+# True if cgroups v2 are enabled
function is_cgroupsv2() {
cgroup_type=$(stat -f -c %T /sys/fs/cgroup)
test "$cgroup_type" = "cgroup2fs"
@@ -305,6 +306,15 @@ function skip_if_no_selinux() {
fi
}
+#######################
+# skip_if_cgroupsv1 # ...with an optional message
+#######################
+function skip_if_cgroupsv1() {
+ if ! is_cgroupsv2; then
+ skip "${1:-test requires cgroupsv2}"
+ fi
+}
+
#########
# die # Abort with helpful message
#########