diff options
author | baude <bbaude@redhat.com> | 2020-12-02 08:45:08 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2020-12-11 09:26:29 -0600 |
commit | 82d7b9f2e21c93cfb12c8f199284c38f3e858280 (patch) | |
tree | 36eefabbfce3167093c9a49ea20e9050a70cb483 /test | |
parent | 47af0afbd15b074561d98a117be353301a354e85 (diff) | |
download | podman-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>
Diffstat (limited to 'test')
21 files changed, 135 insertions, 15 deletions
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 |