Print docker container logs in webapp test. #649

Merged
telackey merged 9 commits from telackey/logs into main 2023-11-14 23:30:02 +00:00
2 changed files with 10 additions and 11 deletions

View File

@ -39,17 +39,12 @@ if [ "$CERC_NEXTJS_SKIP_GENERATE" != "true" ]; then
count=0 count=0
generate_done="false" generate_done="false"
while [ $count -lt $CERC_MAX_GENERATE_TIME ]; do while [ $count -lt $CERC_MAX_GENERATE_TIME ] && [ "$generate_done" == "false" ]; do
sleep 1 sleep 1
count=$((count + 1))
grep 'rendered as static HTML' gen.out > /dev/null grep 'rendered as static HTML' gen.out > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
generate_done="true" generate_done="true"
ps -ef | grep 'node' | grep 'next' | grep 'generate' >/dev/null
if [ $? -ne 0 ]; then
break
fi
else
count=$((count + 1))
fi fi
done done

View File

@ -1,8 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
# Dump environment variables for debugging # Dump environment variables for debugging
echo "Environment variables:" echo "Environment variables:"
env env
@ -28,16 +30,18 @@ CHECK="SPECIAL_01234567890_TEST_STRING"
set +e set +e
CONTAINER_ID=$(docker run -p 3000:3000 -d cerc/test-progressive-web-app:local) CONTAINER_ID=$(docker run -p 3000:3000 -d -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG cerc/test-progressive-web-app:local)
sleep 3 sleep 3
wget -O test.before -m http://localhost:3000 wget -t 7 -O test.before -m http://localhost:3000
docker logs $CONTAINER_ID
docker remove -f $CONTAINER_ID docker remove -f $CONTAINER_ID
CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -d cerc/test-progressive-web-app:local) CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG -d cerc/test-progressive-web-app:local)
sleep 3 sleep 3
wget -O test.after -m http://localhost:3000 wget -t 7 -O test.after -m http://localhost:3000
docker logs $CONTAINER_ID
docker remove -f $CONTAINER_ID docker remove -f $CONTAINER_ID
echo "###########################################################################" echo "###########################################################################"