summaryrefslogtreecommitdiff
path: root/test/kpod_run.bats
diff options
context:
space:
mode:
Diffstat (limited to 'test/kpod_run.bats')
-rw-r--r--test/kpod_run.bats42
1 files changed, 36 insertions, 6 deletions
diff --git a/test/kpod_run.bats b/test/kpod_run.bats
index 56995316b..bcc1d816d 100644
--- a/test/kpod_run.bats
+++ b/test/kpod_run.bats
@@ -2,19 +2,18 @@
load helpers
-ALPINE="docker.io/library/alpine:latest"
+function setup() {
+ copy_images
+}
@test "run a container based on local image" {
- run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest
- echo "$output"
- [ "$status" -eq 0 ]
- run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run docker.io/library/busybox:latest ls
+ run ${KPOD_BINARY} ${KPOD_OPTIONS} run $BB ls
echo "$output"
[ "$status" -eq 0 ]
}
@test "run a container based on a remote image" {
- run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} ls
+ run ${KPOD_BINARY} ${KPOD_OPTIONS} run ${BB_GLIBC} ls
echo "$output"
[ "$status" -eq 0 ]
}
@@ -60,3 +59,34 @@ ALPINE="docker.io/library/alpine:latest"
[ "$status" -eq 0 ]
}
+
+@test "run environment test" {
+
+ ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${ALPINE}
+
+ run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO=BAR ${ALPINE} printenv FOO | tr -d '\r'"
+ echo "$output"
+ [ "$status" -eq 0 ]
+ [ $output = "BAR" ]
+
+ run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -env PATH="/bin" ${ALPINE} printenv PATH | tr -d '\r'"
+ echo "$output"
+ [ "$status" -eq 0 ]
+ [ $output = "/bin" ]
+
+ run bash -c "export FOO=BAR; ${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO ${ALPINE} printenv FOO | tr -d '\r'"
+ echo "$output"
+ [ "$status" -eq 0 ]
+ [ "$output" = "BAR" ]
+
+ run ${KPOD_BINARY} ${KPOD_OPTIONS} run -env FOO ${ALPINE} printenv
+ echo "$output"
+ [ "$status" -ne 0 ]
+
+# We don't currently set the hostname in containers, since we are not setting up
+# networking. As soon as kpod run gets network support we need to uncomment this
+# test.
+# run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} sh -c printenv | grep HOSTNAME"
+# echo "$output"
+# [ "$status" -eq 0 ]
+}