-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8553 from baude/composeci
add compose regression to ci
- Loading branch information
Showing
33 changed files
with
603 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Tests for docker-compose | ||
======================== | ||
|
||
This directory contains tests for docker-compose under podman. | ||
|
||
Each subdirectory must contain one docker-compose.yml file along with | ||
all necessary infrastructure for it (e.g. Containerfile, any files | ||
to be copied into the container, and so on. | ||
|
||
The `test-compose` script will, for each test subdirectory: | ||
|
||
* set up a fresh podman root under an empty working directory; | ||
* run a podman server rooted therein; | ||
* cd to the test subdirectory, and run `docker-compose up -d`; | ||
* source `tests.sh`; | ||
* run `docker-compose down`. | ||
|
||
As a special case, `setup.sh` and `teardown.sh` in the test directory | ||
will contain commands to be executed prior to `docker-compose up` and | ||
after `docker-compose down` respectively. | ||
|
||
tests.sh will probably contain commands of the form | ||
|
||
test_port 12345 = 'hello there' | ||
|
||
Where 12345 is the port to curl to; '=' checks equality, '~' uses `expr` | ||
to check substrings; and 'hello there' is a string to look for in | ||
the curl results. | ||
|
||
Usage: | ||
|
||
$ sudo test/compose/test-compose [pattern] | ||
|
||
By default, all subdirs will be run. If given a pattern, only those | ||
subdirectories matching 'pattern' will be run. | ||
|
||
If `$COMPOSE_WAIT` is set, `test-compose` will pause before running | ||
`docker-compose down`. This can be helpful for you to debug failing tests: | ||
|
||
$ env COMPOSE_WAIT=1 sudo --preserve-env=COMPOSE_WAIT test/compose/test-compose | ||
|
||
Then, in another window, | ||
|
||
# ls -lt /var/tmp/ | ||
# X=/var/tmp/test-compose.tmp.XXXXXX <--- most recent results of above | ||
# podman --root $X/root --runroot $X/runroot ps -a | ||
# podman --root $X/root --runroot $X/runroot logs -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
environment variable and volume | ||
=============== | ||
|
||
This test creates two containers both of which are running flask. The first container has | ||
an environment variable called PODMAN_MSG. That container pipes the contents of PODMAN_MSG | ||
to a file on a shared volume between the containers. The second container then reads the | ||
file are returns the PODMAN_MSG value via flask (http). | ||
|
||
Validation | ||
------------ | ||
* curl http://localhost:5000 and verify message | ||
* curl http://localhost:5001 and verify message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM quay.io/libpod/podman_python | ||
WORKDIR /app | ||
COPY . /app | ||
ENTRYPOINT ["python3"] | ||
CMD ["app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- bash -*- | ||
|
||
test_port 5000 = "done" | ||
test_port 5001 = "podman_rulez" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM quay.io/libpod/podman_python | ||
WORKDIR /app | ||
COPY . /app | ||
ENTRYPOINT ["python3"] | ||
CMD ["app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
images | ||
====== | ||
|
||
Use these directories for images that are needed for the compose testing. These | ||
images should be then pushed to `quay.io/libpod` for consumption. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM alpine | ||
WORKDIR /app | ||
RUN apk update && apk add py3-pip && pip3 install flask && rm -fr /var/cache/apk/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
mount and label | ||
=============== | ||
|
||
This test creates a container with a mount (not volume) and also adds a label to the container. | ||
|
||
Validation | ||
------------ | ||
* curl http://localhost:5000 and verify message | ||
* inspect the container to make the label exists on it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '3' | ||
services: | ||
web: | ||
build: frontend | ||
ports: | ||
- '5000:5000' | ||
volumes: | ||
- /tmp/data:/data:ro | ||
labels: | ||
- "io.podman=the_best" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM quay.io/libpod/podman_python | ||
WORKDIR /app | ||
COPY . /app | ||
ENTRYPOINT ["python3"] | ||
CMD ["app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mkdir -p /tmp/data | ||
echo "Podman rulez!" > /tmp/data/message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rm /tmp/data/message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- bash -*- | ||
|
||
test_port 5000 = "Podman rulez!" | ||
podman container inspect -l --format '{{.Config.Labels}}' | grep "the_best" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
port map on different port | ||
=============== | ||
|
||
This test creates a container that runs flask on different ports for the container | ||
and the host | ||
|
||
Validation | ||
------------ | ||
* curl http://localhost:5001 and verify message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: '3' | ||
services: | ||
web: | ||
build: frontend | ||
ports: | ||
- '5001:5000' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM quay.io/libpod/podman_python | ||
WORKDIR /app | ||
COPY . /app | ||
ENTRYPOINT ["python3"] | ||
CMD ["app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- bash -*- | ||
|
||
test_port 5001 = "Podman rulez!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- bash -*- | ||
|
||
export ENV_PASSTHRU=$(random_string 20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
simple port map to host | ||
=============== | ||
|
||
This test creates a container that runs flask on and maps to the same | ||
host port | ||
|
||
Validation | ||
------------ | ||
* curl http://localhost:5000 and verify message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: '3' | ||
services: | ||
web: | ||
build: frontend | ||
ports: | ||
- '5000:5000' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from flask import Flask | ||
import os | ||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def hello(): | ||
return "Podman rulez!" | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- bash -*- | ||
|
||
test_port 5000 = "Podman rulez!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- bash -*- | ||
|
||
# FIXME: this is completely unnecessary; it's just an example of a teardown | ||
unset ENV_PASSTHRU |
Oops, something went wrong.