Add new docker-compose test for two networks

Also fix the tests so we can use the podman function with the output.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
Paul Holzinger
2021-03-21 18:23:31 +01:00
parent 954d920825
commit 676fcb722f
5 changed files with 32 additions and 4 deletions

View File

@ -1,4 +1,5 @@
# -*- bash -*- # -*- bash -*-
test_port 5000 = "Podman rulez!" test_port 5000 = "Podman rulez!"
podman container inspect -l --format '{{.Config.Labels}}' | grep "the_best" podman container inspect -l --format '{{.Config.Labels}}'
like "$output" "io.podman:the_best" "$testname : Container label is set"

View File

@ -224,10 +224,11 @@ function start_service() {
############ ############
function podman() { function podman() {
echo "\$ podman $*" >>$WORKDIR/output.log echo "\$ podman $*" >>$WORKDIR/output.log
$PODMAN_BIN \ output=$($PODMAN_BIN \
--root $WORKDIR/root \ --root $WORKDIR/root \
--runroot $WORKDIR/runroot \ --runroot $WORKDIR/runroot \
"$@" >>$WORKDIR/output.log 2>&1 "$@")
echo -n "$output" >>$WORKDIR/output.log
} }
################### ###################
@ -329,7 +330,7 @@ for t in ${tests_to_run[@]}; do
fi fi
# Done. Clean up. # Done. Clean up.
docker-compose down &> $logfile docker-compose down &>> $logfile
rc=$? rc=$?
if [[ $rc -eq 0 ]]; then if [[ $rc -eq 0 ]]; then
_show_ok 1 "$testname - down" _show_ok 1 "$testname - down"

View File

@ -0,0 +1,8 @@
two networks
===============
This test checks that we can create containers with more than one network.
Validation
------------
* podman container inspect two_networks_con1_1 --format '{{len .NetworkSettings.Networks}}' shows 2

View File

@ -0,0 +1,11 @@
version: '3'
services:
con1:
image: alpine
command: top
networks:
- net1
- net2
networks:
net1:
net2:

View File

@ -0,0 +1,7 @@
# -*- bash -*-
podman container inspect two_networks_con1_1 --format '{{len .NetworkSettings.Networks}}'
is "$output" "2" "$testname : Container is connected to both networks"
podman container inspect two_networks_con1_1 --format '{{.NetworkSettings.Networks}}'
like "$output" "two_networks_net1" "$testname : First network name exists"
like "$output" "two_networks_net2" "$testname : Second network name exists"