summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/healthcheck_run_test.go38
-rw-r--r--test/e2e/play_kube_test.go58
-rw-r--r--test/system/030-run.bats4
-rw-r--r--test/system/120-load.bats43
4 files changed, 117 insertions, 26 deletions
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index c2084a6fd..6a79006b6 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -2,7 +2,9 @@ package integration
import (
"fmt"
+ "io/ioutil"
"os"
+ "path/filepath"
"time"
define "github.com/containers/podman/v3/libpod/define"
@@ -258,4 +260,40 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(startAgain.OutputToString()).To(Equal("hc"))
Expect(startAgain.ErrorToString()).To(Equal(""))
})
+
+ It("Verify default time is used and no utf-8 escapes", func() {
+ cwd, err := os.Getwd()
+ Expect(err).To(BeNil())
+
+ podmanTest.AddImageToRWStore(ALPINE)
+ // Write target and fake files
+ targetPath, err := CreateTempDirInTempDir()
+ Expect(err).To(BeNil())
+ containerfile := fmt.Sprintf(`FROM %s
+HEALTHCHECK CMD ls -l / 2>&1`, ALPINE)
+ containerfilePath := filepath.Join(targetPath, "Containerfile")
+ err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
+ Expect(err).To(BeNil())
+ defer func() {
+ Expect(os.Chdir(cwd)).To(BeNil())
+ Expect(os.RemoveAll(targetPath)).To(BeNil())
+ }()
+
+ // make cwd as context root path
+ Expect(os.Chdir(targetPath)).To(BeNil())
+
+ session := podmanTest.Podman([]string{"build", "--format", "docker", "-t", "test", "."})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ run := podmanTest.Podman([]string{"run", "-dt", "--name", "hctest", "test", "ls"})
+ run.WaitWithDefaultTimeout()
+ Expect(run).Should(Exit(0))
+
+ inspect := podmanTest.InspectContainer("hctest")
+ // Check to make sure a default time value was added
+ Expect(inspect[0].Config.Healthcheck.Timeout).To(BeNumerically("==", 30000000000))
+ // Check to make sure characters were not coerced to utf8
+ Expect(inspect[0].Config.Healthcheck.Test).To(Equal([]string{"CMD-SHELL", "ls -l / 2>&1"}))
+ })
})
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index f79710ee6..1c7eb09a4 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -37,6 +37,31 @@ metadata:
spec:
hostname: unknown
`
+
+var podnameEqualsContainerNameYaml = `
+apiVersion: v1
+kind: Pod
+metadata:
+ name: podnameEqualsContainerNameYaml
+spec:
+ containers:
+ - name: podnameEqualsContainerNameYaml
+ image: quay.io/libpod/alpine:latest
+ ports:
+ - containerPort: 80
+`
+
+var podWithoutAName = `
+apiVersion: v1
+kind: Pod
+spec:
+ containers:
+ - name: podDoesntHaveAName
+ image: quay.io/libpod/alpine:latest
+ ports:
+ - containerPort: 80
+`
+
var checkInfraImagePodYaml = `
apiVersion: v1
kind: Pod
@@ -1278,6 +1303,39 @@ var _ = Describe("Podman play kube", func() {
Expect(sharednamespaces).To(ContainSubstring("pid"))
})
+ It("podman play kube should not rename pod if container in pod has same name", func() {
+ err := writeYaml(podnameEqualsContainerNameYaml, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ testPodCreated := podmanTest.Podman([]string{"pod", "exists", "podnameEqualsContainerNameYaml"})
+ testPodCreated.WaitWithDefaultTimeout()
+ Expect(testPodCreated).Should(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", "podnameEqualsContainerNameYaml"})
+ inspect.WaitWithDefaultTimeout()
+ podInspect := inspect.InspectPodArrToJSON()
+ Expect(podInspect).Should(HaveLen(1))
+ var containerNames []string
+ for _, container := range podInspect[0].Containers {
+ containerNames = append(containerNames, container.Name)
+ }
+ Expect(containerNames).To(ContainElement("podnameEqualsContainerNameYaml-podnameEqualsContainerNameYaml"))
+ })
+
+ It("podman play kube should error if pod dont have a name", func() {
+ err := writeYaml(podWithoutAName, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(125))
+
+ })
+
It("podman play kube support container liveness probe", func() {
err := writeYaml(livenessProbePodYaml, kubeYaml)
Expect(err).To(BeNil())
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index d81a0758c..feca5370b 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -14,8 +14,8 @@ load helpers
# ...but check the configured runtime engine, and switch to crun as needed
run_podman info --format '{{ .Host.OCIRuntime.Path }}'
if expr "$output" : ".*/crun"; then
- err_no_such_cmd="Error: executable file.* not found in \$PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found"
- err_no_exec_dir="Error: open executable: Operation not permitted: OCI permission denied"
+ err_no_such_cmd="Error: crun: executable file.* not found in \$PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found"
+ err_no_exec_dir="Error: crun: open executable: Operation not permitted: OCI permission denied"
fi
tests="
diff --git a/test/system/120-load.bats b/test/system/120-load.bats
index 541095764..b1d181d50 100644
--- a/test/system/120-load.bats
+++ b/test/system/120-load.bats
@@ -79,31 +79,26 @@ verify_iid_and_name() {
}
@test "podman image scp transfer" {
- skip_if_root_ubuntu "cannot create a new user successfully on ubuntu"
+ skip_if_remote "only applicable under local podman"
+
+ skip "FIXME FIXME FIXME: this needs a big rewrite"
+
get_iid_and_name
- if ! is_remote; then
- if is_rootless; then
- whoami=$(id -un)
- run_podman image scp $whoami@localhost::$iid root@localhost::
- if [ "$status" -ne 0 ]; then
- die "Command failed: podman image scp transfer"
- fi
- whoami=$(id -un)
- run_podman image scp -q $whoami@localhost::$iid root@localhost::
- if [ "$status" -ne 0 ]; then
- die "Command failed: podman image scp quiet transfer failed"
- fi
- fi
- if ! is_rootless; then
- id -u 1000 &>/dev/null || useradd -u 1000 -g 1000 testingUsr
- if [ "$status" -ne 0 ]; then
- die "Command failed: useradd 1000"
- fi
- run_podman image scp root@localhost::$iid 1000:1000@localhost::
- if [ "$status" -ne 0 ]; then
- die "Command failed: podman image scp transfer"
- fi
- fi
+ if is_rootless; then
+ whoami=$(id -un)
+ # FIXME: first, test that we can sudo. If we can't, skip.
+ # FIXME: test 'scp $IMAGE root@localhost::'
+ # FIXME: then test the rest
+ # FIXME: check output
+ run_podman image scp $whoami@localhost::$iid root@localhost::
+ is "$output" "Loaded image.*: $iid" "...."
+
+ # FIXME: "-q" is a NOP
+ run_podman image scp -q $whoami@localhost::$iid root@localhost::
+ else
+ # root
+ # FIXME: identify a rootless user. DO NOT CREATE ONE.
+ run_podman image scp root@localhost::$iid 1000:1000@localhost::
fi
}