From a9d2fb1982e6062214c5bab3db91672be7dc3da4 Mon Sep 17 00:00:00 2001 From: meskio Date: Mon, 19 Dec 2022 20:04:44 +0100 Subject: [PATCH] Add test --- docker-compose.yml | 4 +--- test | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) create mode 100755 test diff --git a/docker-compose.yml b/docker-compose.yml index 35c62a1..36259f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,7 @@ version: '2.4' services: db: - # TODO: fix our mariadb container - #image: registry.sindominio.net/mariadb - image: mysql + image: registry.sindominio.net/mariadb user: "$USER_GROUP" restart: always volumes: diff --git a/test b/test new file mode 100755 index 0000000..479d07c --- /dev/null +++ b/test @@ -0,0 +1,42 @@ +#!/bin/bash + +tear_down () { + docker-compose stop + cd .. + rm -rf tmp +} + +mkdir tmp +cp env.sample tmp/.env +cat docker-compose.yml | sed 's/registry.sindominio.net\/wordpress/wordpress/' > tmp/docker-compose.yml +cd tmp + +mkdir db uploads +chown 1000:1000 db uploads + +docker-compose up -d + +# Wait for the web server to respond +cont=0 +echo -n "Espera al servidor web " +while ! curl -s localhost:8080 > /dev/null; do + echo -n "." + cont=$((cont+1)) + if [ "$cont" == 30 ]; then + echo " no responde" + tear_down + exit 1 + fi + sleep 1 +done +echo " connectado" + +STR=`curl -s localhost:8080 |grep "Hello world!"` +tear_down + +if [[ "$STR" == "" ]] +then + echo "No encontre 'Hello world!' en la web del contenedor" + exit 1 +fi +