wordpress/test

52 lines
961 B
Plaintext
Raw Normal View History

2022-12-19 20:04:44 +01:00
#!/bin/bash
TMP=/tmp/wordpress
2023-02-04 15:48:11 +01:00
TIMEOUT=120
2023-02-25 01:13:50 +01:00
HPATH=$(pwd)
2022-12-19 20:04:44 +01:00
tear_down () {
2023-02-25 01:09:15 +01:00
echo "Clean"
cd $TMP
2022-12-19 20:04:44 +01:00
docker-compose stop
docker-compose down -v --remove-orphans
2023-02-25 01:09:15 +01:00
docker network prune -f
2022-12-19 20:04:44 +01:00
cd ..
rm -rf $TMP
2023-02-25 01:09:15 +01:00
cd $HPATH
2022-12-19 20:04:44 +01:00
}
2023-02-25 01:09:15 +01:00
[ -d $TMP ] && tear_down
mkdir $TMP
cat env.sample | sed "s/USER_GROUP.*$/USER_GROUP=`id -u`:`id -g`/" > $TMP/.env
cat docker-compose.yml | sed 's/registry.sindominio.net\/wordpress/wordpress/' > $TMP/docker-compose.yml
2022-12-19 20:04:44 +01:00
cd $TMP
2022-12-19 20:04:44 +01:00
mkdir db uploads
2023-02-04 15:40:06 +01:00
docker-compose down -v --remove-orphans
2022-12-19 20:04:44 +01:00
docker-compose up -d
# Wait for the web server to respond
cont=0
echo -n "Espera al servidor web "
2022-12-19 20:20:22 +01:00
while ! curl -s localhost:12001 > /dev/null; do
2022-12-19 20:04:44 +01:00
echo -n "."
cont=$((cont+1))
2023-02-04 15:48:11 +01:00
if [ "$cont" == $TIMEOUT ]; then
2022-12-19 20:04:44 +01:00
echo " no responde"
tear_down
exit 1
fi
sleep 1
done
echo " connectado"
2022-12-19 20:20:22 +01:00
STR=`curl -s localhost:12001 |grep "Hello world!"`
2022-12-19 20:04:44 +01:00
tear_down
if [[ "$STR" == "" ]]
then
echo "No encontre 'Hello world!' en la web del contenedor"
exit 1
fi