aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-12-02 08:45:08 -0600
committerbaude <bbaude@redhat.com>2020-12-11 09:26:29 -0600
commit82d7b9f2e21c93cfb12c8f199284c38f3e858280 (patch)
tree36eefabbfce3167093c9a49ea20e9050a70cb483
parent47af0afbd15b074561d98a117be353301a354e85 (diff)
downloadpodman-82d7b9f2e21c93cfb12c8f199284c38f3e858280.tar.gz
podman-82d7b9f2e21c93cfb12c8f199284c38f3e858280.tar.bz2
podman-82d7b9f2e21c93cfb12c8f199284c38f3e858280.zip
add compose regression to ci
to prevent any regressions, we should be running regression tests using compose. Signed-off-by: baude <bbaude@redhat.com>
-rw-r--r--.cirrus.yml18
-rwxr-xr-xcontrib/cirrus/runner.sh4
-rwxr-xr-xcontrib/cirrus/setup_environment.sh1
-rw-r--r--test/compose/elasticsearch-logstash-kibana.curl3
-rw-r--r--test/compose/env_and_volume/docker-compose.yml18
-rw-r--r--test/compose/env_and_volume/read/Dockerfile5
-rw-r--r--test/compose/env_and_volume/read/app.py10
-rw-r--r--test/compose/env_and_volume/write/Dockerfile5
-rw-r--r--test/compose/env_and_volume/write/app.py13
-rw-r--r--test/compose/flask.curl (renamed from test/docker-compose/flask.curl)0
-rw-r--r--test/compose/gitea-postgres.curl (renamed from test/docker-compose/gitea-postgres.curl)0
-rw-r--r--test/compose/mount_and_label/docker-compose.yml10
-rw-r--r--test/compose/mount_and_label/frontend/Dockerfile5
-rw-r--r--test/compose/mount_and_label/frontend/app.py10
-rw-r--r--test/compose/mount_and_label/readme.txt5
-rw-r--r--test/compose/port_map_diff_port/docker-compose.yml6
-rw-r--r--test/compose/port_map_diff_port/frontend/Dockerfile5
-rw-r--r--test/compose/port_map_diff_port/frontend/app.py9
-rw-r--r--test/compose/react-rust-postgres.skip (renamed from test/docker-compose/react-rust-postgres.skip)0
-rw-r--r--test/compose/simple_port_map/docker-compose.yml6
-rw-r--r--test/compose/simple_port_map/frontend/Dockerfile6
-rw-r--r--test/compose/simple_port_map/frontend/app.py9
-rwxr-xr-xtest/compose/test-compose (renamed from test/docker-compose/test-docker-compose)22
-rw-r--r--test/docker-compose/elasticsearch-logstash-kibana.curl3
24 files changed, 157 insertions, 16 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index 0fa51be63..8507aa3d2 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -30,7 +30,7 @@ env:
PRIOR_UBUNTU_NAME: "ubuntu-19"
# Google-cloud VM Images
- IMAGE_SUFFIX: "c5402398833246208"
+ IMAGE_SUFFIX: "c4704091098054656"
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}"
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-${IMAGE_SUFFIX}"
@@ -434,6 +434,21 @@ apiv2_test_task:
podman_system_info_script: '$SCRIPT_BASE/logcollector.sh podman'
time_script: '$SCRIPT_BASE/logcollector.sh time'
+compose_test_task:
+ name: "compose test on $DISTRO_NV"
+ alias: compose_test
+ depends_on:
+ - validate
+ gce_instance: *standardvm
+ env:
+ <<: *stdenvars
+ TEST_FLAVOR: compose
+ clone_script: *noop # Comes from cache
+ gopath_cache: *ro_gopath_cache
+ setup_script: *setup
+ main_script: *main
+ always: *logs_artifacts
+
# Execute the podman integration tests on all primary platforms and release
# versions, as root, without involving the podman-remote client.
@@ -619,6 +634,7 @@ success_task:
- docker-py_test
- unit_test
- apiv2_test
+ - compose_test
- local_integration_test
- remote_integration_test
- rootless_integration_test
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index fa921f3e4..cc6d155f9 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -73,6 +73,10 @@ function _run_apiv2() {
make localapiv2 |& logformatter
}
+function _run_compose() {
+ ./test/compose/test-compose |& logformatter
+}
+
function _run_int() {
dotest integration
}
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index c32b45a4f..a3c0f9a13 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -195,6 +195,7 @@ case "$TEST_FLAVOR" in
build) make clean ;;
unit) ;;
apiv2) ;& # use next item
+ compose) ;&
int) ;&
sys) ;&
bindings) ;&
diff --git a/test/compose/elasticsearch-logstash-kibana.curl b/test/compose/elasticsearch-logstash-kibana.curl
new file mode 100644
index 000000000..ddb7a96b0
--- /dev/null
+++ b/test/compose/elasticsearch-logstash-kibana.curl
@@ -0,0 +1,3 @@
+9200 You Know, for Search
+9600 "status":"green"
+5601 Kibana
diff --git a/test/compose/env_and_volume/docker-compose.yml b/test/compose/env_and_volume/docker-compose.yml
new file mode 100644
index 000000000..df906e170
--- /dev/null
+++ b/test/compose/env_and_volume/docker-compose.yml
@@ -0,0 +1,18 @@
+version: '3'
+services:
+ writer:
+ environment:
+ - PODMAN_MSG=podman_rulez
+ build: write
+ ports:
+ - '5000:5000'
+ volumes:
+ - data:/data
+ reader:
+ build: read
+ ports:
+ - '5001:5000'
+ volumes:
+ - data:/data
+volumes:
+ data:
diff --git a/test/compose/env_and_volume/read/Dockerfile b/test/compose/env_and_volume/read/Dockerfile
new file mode 100644
index 000000000..a393a0dcb
--- /dev/null
+++ b/test/compose/env_and_volume/read/Dockerfile
@@ -0,0 +1,5 @@
+FROM podman_python
+WORKDIR /app
+COPY . /app
+ENTRYPOINT ["python3"]
+CMD ["app.py"]
diff --git a/test/compose/env_and_volume/read/app.py b/test/compose/env_and_volume/read/app.py
new file mode 100644
index 000000000..71fbbb26a
--- /dev/null
+++ b/test/compose/env_and_volume/read/app.py
@@ -0,0 +1,10 @@
+from flask import Flask
+app = Flask(__name__)
+
+@app.route('/')
+def hello():
+ f = open("/data/message", "r")
+ return f.read()
+
+if __name__ == '__main__':
+ app.run(host='0.0.0.0')
diff --git a/test/compose/env_and_volume/write/Dockerfile b/test/compose/env_and_volume/write/Dockerfile
new file mode 100644
index 000000000..a393a0dcb
--- /dev/null
+++ b/test/compose/env_and_volume/write/Dockerfile
@@ -0,0 +1,5 @@
+FROM podman_python
+WORKDIR /app
+COPY . /app
+ENTRYPOINT ["python3"]
+CMD ["app.py"]
diff --git a/test/compose/env_and_volume/write/app.py b/test/compose/env_and_volume/write/app.py
new file mode 100644
index 000000000..b6ad6fe63
--- /dev/null
+++ b/test/compose/env_and_volume/write/app.py
@@ -0,0 +1,13 @@
+from flask import Flask
+import os
+app = Flask(__name__)
+
+@app.route('/')
+def hello():
+ f = open("/data/message", "w")
+ f.write(os.getenv("PODMAN_MSG"))
+ f.close()
+ return "done"
+
+if __name__ == '__main__':
+ app.run(host='0.0.0.0')
diff --git a/test/docker-compose/flask.curl b/test/compose/flask.curl
index b50ddbf1d..b50ddbf1d 100644
--- a/test/docker-compose/flask.curl
+++ b/test/compose/flask.curl
diff --git a/test/docker-compose/gitea-postgres.curl b/test/compose/gitea-postgres.curl
index a0a58b3fd..a0a58b3fd 100644
--- a/test/docker-compose/gitea-postgres.curl
+++ b/test/compose/gitea-postgres.curl
diff --git a/test/compose/mount_and_label/docker-compose.yml b/test/compose/mount_and_label/docker-compose.yml
new file mode 100644
index 000000000..6487067e3
--- /dev/null
+++ b/test/compose/mount_and_label/docker-compose.yml
@@ -0,0 +1,10 @@
+version: '3'
+services:
+ web:
+ build: frontend
+ ports:
+ - '5000:5000'
+ volumes:
+ - /tmp/mount:/data:ro
+ labels:
+ - "io.podman=the_best"
diff --git a/test/compose/mount_and_label/frontend/Dockerfile b/test/compose/mount_and_label/frontend/Dockerfile
new file mode 100644
index 000000000..a393a0dcb
--- /dev/null
+++ b/test/compose/mount_and_label/frontend/Dockerfile
@@ -0,0 +1,5 @@
+FROM podman_python
+WORKDIR /app
+COPY . /app
+ENTRYPOINT ["python3"]
+CMD ["app.py"]
diff --git a/test/compose/mount_and_label/frontend/app.py b/test/compose/mount_and_label/frontend/app.py
new file mode 100644
index 000000000..bd2794d94
--- /dev/null
+++ b/test/compose/mount_and_label/frontend/app.py
@@ -0,0 +1,10 @@
+from flask import Flask
+app = Flask(__name__)
+
+@app.route('/')
+def hello():
+ f = open("/data/message")
+ return f.read()
+
+if __name__ == '__main__':
+ app.run(host='0.0.0.0')
diff --git a/test/compose/mount_and_label/readme.txt b/test/compose/mount_and_label/readme.txt
new file mode 100644
index 000000000..bba769c51
--- /dev/null
+++ b/test/compose/mount_and_label/readme.txt
@@ -0,0 +1,5 @@
+this test creates a container with a mount (not volume) and also adds a label to the container.
+
+validate by curl http://localhost:5000 and message should be same message as piped into the mount message.
+
+also verify the label with podman ps and a filter that only catches that container
diff --git a/test/compose/port_map_diff_port/docker-compose.yml b/test/compose/port_map_diff_port/docker-compose.yml
new file mode 100644
index 000000000..3003c52f4
--- /dev/null
+++ b/test/compose/port_map_diff_port/docker-compose.yml
@@ -0,0 +1,6 @@
+version: '3'
+services:
+ web:
+ build: frontend
+ ports:
+ - '5001:5000'
diff --git a/test/compose/port_map_diff_port/frontend/Dockerfile b/test/compose/port_map_diff_port/frontend/Dockerfile
new file mode 100644
index 000000000..a393a0dcb
--- /dev/null
+++ b/test/compose/port_map_diff_port/frontend/Dockerfile
@@ -0,0 +1,5 @@
+FROM podman_python
+WORKDIR /app
+COPY . /app
+ENTRYPOINT ["python3"]
+CMD ["app.py"]
diff --git a/test/compose/port_map_diff_port/frontend/app.py b/test/compose/port_map_diff_port/frontend/app.py
new file mode 100644
index 000000000..895556a89
--- /dev/null
+++ b/test/compose/port_map_diff_port/frontend/app.py
@@ -0,0 +1,9 @@
+from flask import Flask
+app = Flask(__name__)
+
+@app.route('/')
+def hello():
+ return "Podman rulez!"
+
+if __name__ == '__main__':
+ app.run(host='0.0.0.0')
diff --git a/test/docker-compose/react-rust-postgres.skip b/test/compose/react-rust-postgres.skip
index 57f89ed17..57f89ed17 100644
--- a/test/docker-compose/react-rust-postgres.skip
+++ b/test/compose/react-rust-postgres.skip
diff --git a/test/compose/simple_port_map/docker-compose.yml b/test/compose/simple_port_map/docker-compose.yml
new file mode 100644
index 000000000..e7eab1047
--- /dev/null
+++ b/test/compose/simple_port_map/docker-compose.yml
@@ -0,0 +1,6 @@
+version: '3'
+services:
+ web:
+ build: frontend
+ ports:
+ - '5000:5000'
diff --git a/test/compose/simple_port_map/frontend/Dockerfile b/test/compose/simple_port_map/frontend/Dockerfile
new file mode 100644
index 000000000..2595828ff
--- /dev/null
+++ b/test/compose/simple_port_map/frontend/Dockerfile
@@ -0,0 +1,6 @@
+FROM alpine
+WORKDIR /app
+RUN apk update && apk add py3-pip && pip3 install flask
+COPY . /app
+ENTRYPOINT ["python3"]
+CMD ["app.py"]
diff --git a/test/compose/simple_port_map/frontend/app.py b/test/compose/simple_port_map/frontend/app.py
new file mode 100644
index 000000000..895556a89
--- /dev/null
+++ b/test/compose/simple_port_map/frontend/app.py
@@ -0,0 +1,9 @@
+from flask import Flask
+app = Flask(__name__)
+
+@app.route('/')
+def hello():
+ return "Podman rulez!"
+
+if __name__ == '__main__':
+ app.run(host='0.0.0.0')
diff --git a/test/docker-compose/test-docker-compose b/test/compose/test-compose
index d37caa12a..f7643b078 100755
--- a/test/docker-compose/test-docker-compose
+++ b/test/compose/test-compose
@@ -81,12 +81,13 @@ function like() {
# "is" (equality) is a subset of "like", but one that expr fails on if
# the expected result has shell-special characters like '['. Treat it
# as a special case.
- if [[ $actual = $expect ]]; then
+
+ if [[ "$actual" = "$expect" ]]; then
_show_ok 1 "$testname=$expect"
return
fi
- if expr "$actual" : "$expect" &>/dev/null; then
+ if expr "$actual" : ".*$expect" &>/dev/null; then
# On success, include expected value; this helps readers understand
_show_ok 1 "$testname ('$actual') ~ $expect"
return
@@ -132,9 +133,9 @@ function _show_ok() {
# Failed
local expect=$3
local actual=$4
- echo -e "${red}not ok $count $testname${reset}"
- echo -e "${red}# expected: $expect${reset}"
- echo -e "${red}# actual: ${bold}$actual${reset}"
+ printf "${red}not ok $count $testname${reset}\n"
+ printf "${red}# expected: %s${reset}\n" "$expect"
+ printf "${red}# actual: ${bold}%s${reset}\n" "$actual"
echo "not ok $count $testname" >>$LOG
echo " expected: $expect" >>$LOG
@@ -347,6 +348,7 @@ done
TESTS_DIR=$WORKDIR/awesome-compose
git clone $AWESOME_COMPOSE $TESTS_DIR
+git -C $TESTS_DIR checkout -q a3c38822277bcca04abbadf34120dcff808db3ec
# Identify the tests to run. If called with args, use those as globs.
tests_to_run=()
@@ -402,14 +404,10 @@ for t in ${tests_to_run[@]}; do
docker-compose down >>$logfile 2>&1
exit 1
fi
- echo "got here: $actual"
like "$actual" "$expect" "$testname : port $port"
done < $curls
fi
- echo "OK, press ENTER to stop"
- read x
-
docker-compose down &> $logfile
if [[ $? -eq 0 ]]; then
_show_ok 1 "$testname - down"
@@ -434,8 +432,8 @@ done
test_count=$(<$testcounter_file)
failure_count=$(<$failures_file)
-#if [ -z "$PODMAN_TESTS_KEEP_WORKDIR" ]; then
-# rm -rf $WORKDIR
-#fi
+if [ -z "$PODMAN_TESTS_KEEP_WORKDIR" ]; then
+ rm -rf $WORKDIR
+fi
exit $failure_count
diff --git a/test/docker-compose/elasticsearch-logstash-kibana.curl b/test/docker-compose/elasticsearch-logstash-kibana.curl
deleted file mode 100644
index 9a94bd65c..000000000
--- a/test/docker-compose/elasticsearch-logstash-kibana.curl
+++ /dev/null
@@ -1,3 +0,0 @@
-9200 elasticsearch
-9600 logstash
-5601 kibana