runtime/tests.sh

177 lines
3.8 KiB
Bash
Raw Normal View History

2020-02-02 21:06:11 +00:00
#!/bin/bash
if [ -z "$DOCKER" ]; then
DOCKER=docker
fi
CONTAINER_NAME=runtime-test
I=1
2020-04-01 21:47:12 +00:00
COUNT=9
2020-02-02 21:06:11 +00:00
PROBLEM=0
function run() {
$DOCKER run -d --rm --name $CONTAINER_NAME rosti/runtime:dev > /dev/null
sleep 5
}
function stop() {
$DOCKER stop $CONTAINER_NAME > /dev/null
sleep 5
}
# Default page
run
2020-02-03 01:30:14 +00:00
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "<title>Roští.cz</title>" > /dev/null
2020-02-02 21:06:11 +00:00
if [ $? -eq 0 ]; then
echo "$I/$COUNT default response correct"
else
echo "$I/$COUNT default response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# Node.js 12.16.1
2020-02-02 21:06:11 +00:00
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-12.16.1 $CONTAINER_NAME su app -c rosti > /dev/null
2020-02-02 21:06:11 +00:00
sleep 3
2020-02-03 01:30:14 +00:00
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
2020-02-02 21:06:11 +00:00
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 12.16.1 response correct"
2020-02-02 21:06:11 +00:00
else
echo "$I/$COUNT Node.js 12.16.1 response incorrect"
2020-02-02 21:06:11 +00:00
PROBLEM=1
fi
2020-04-01 21:47:12 +00:00
I=$((I+1))
stop
# Node.js 12.18.3
2020-04-01 21:47:12 +00:00
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-12.18.3 $CONTAINER_NAME su app -c rosti > /dev/null
2020-04-01 21:47:12 +00:00
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 12.18.3 response correct"
2020-04-01 21:47:12 +00:00
else
echo "$I/$COUNT Node.js 12.18.3 response incorrect"
2020-04-01 21:47:12 +00:00
PROBLEM=1
fi
2020-02-02 21:06:11 +00:00
I=$((I+1))
stop
###############
# Node.js 13.7.0
2020-04-01 21:47:12 +00:00
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-13.7.0 $CONTAINER_NAME su app -c rosti > /dev/null
2020-04-01 21:47:12 +00:00
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 13.7.0 response correct"
2020-04-01 21:47:12 +00:00
else
echo "$I/$COUNT Node.js 13.7.0 response incorrect"
2020-04-01 21:47:12 +00:00
PROBLEM=1
fi
I=$((I+1))
stop
# Node.js 14.8.0
2020-02-02 21:06:11 +00:00
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-14.8.0 $CONTAINER_NAME su app -c rosti > /dev/null
2020-02-02 21:06:11 +00:00
sleep 3
2020-02-03 01:30:14 +00:00
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
2020-02-02 21:06:11 +00:00
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 14.8.0 response correct"
2020-02-02 21:06:11 +00:00
else
echo "$I/$COUNT Node.js 14.8.0 response incorrect"
2020-02-02 21:06:11 +00:00
PROBLEM=1
fi
I=$((I+1))
stop
###############
# Python 3.8.2
2020-02-02 21:06:11 +00:00
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=python-3.8.2 $CONTAINER_NAME su app -c rosti > /dev/null
2020-02-02 21:06:11 +00:00
sleep 5
2020-02-03 01:30:14 +00:00
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "app.py" > /dev/null
2020-02-02 21:06:11 +00:00
if [ $? -eq 0 ]; then
echo "$I/$COUNT Python 3.8.2 response correct"
2020-02-02 21:06:11 +00:00
else
echo "$I/$COUNT Python 3.8.2 response incorrect"
2020-02-02 21:06:11 +00:00
PROBLEM=1
fi
2020-04-01 21:47:12 +00:00
I=$((I+1))
stop
# Python 3.8.5
2020-04-01 21:47:12 +00:00
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=python-3.8.5 $CONTAINER_NAME su app -c rosti > /dev/null
2020-04-01 21:47:12 +00:00
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "app.py" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Python 3.8.5 response correct"
2020-04-01 21:47:12 +00:00
else
echo "$I/$COUNT Python 3.8.5 response incorrect"
2020-04-01 21:47:12 +00:00
PROBLEM=1
fi
2020-02-02 21:06:11 +00:00
I=$((I+1))
stop
###############
# PHP 7.4.4
2020-02-02 21:06:11 +00:00
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=php-7.4.4 $CONTAINER_NAME su app -c rosti > /dev/null
2020-02-02 21:06:11 +00:00
sleep 5
2020-02-03 01:30:14 +00:00
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "PHP aplikaci" > /dev/null
2020-02-02 21:06:11 +00:00
if [ $? -eq 0 ]; then
echo "$I/$COUNT PHP 7.4.4 response correct"
2020-02-02 21:06:11 +00:00
else
echo "$I/$COUNT PHP 7.4.4 response incorrect"
2020-02-02 21:06:11 +00:00
PROBLEM=1
fi
I=$((I+1))
stop
2020-04-01 21:47:12 +00:00
# PHP 7.4.9
2020-04-01 21:47:12 +00:00
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=php-7.4.9 $CONTAINER_NAME su app -c rosti > /dev/null
2020-04-01 21:47:12 +00:00
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "PHP aplikaci" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT PHP 7.4.9 response correct"
2020-04-01 21:47:12 +00:00
else
echo "$I/$COUNT PHP 7.4.9 response incorrect"
2020-04-01 21:47:12 +00:00
PROBLEM=1
fi
I=$((I+1))
stop
2020-02-02 21:06:11 +00:00
###############
if [ "$PROBLEM" = "0" ]; then
echo
echo "All OK"
exit 0
else
echo
echo "Problem found"
exit 1
fi