Automatic testing script
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Adam Štrauch 2021-11-19 23:52:57 +01:00
parent 69464ac670
commit 7fc67804a8
Signed by: cx
GPG Key ID: 018304FFA8988F8D
3 changed files with 34 additions and 2 deletions

View File

@ -38,4 +38,14 @@ steps:
privileged: true privileged: true
commands: commands:
- echo "$password" | podman login -u $username --password-stdin $repo - echo "$password" | podman login -u $username --password-stdin $repo
- make DOCKER=podman build - make VERSION=test DOCKER=podman build
- name: test image
image: harbor.hq.rosti.cz/library/builder:35
environment:
username: robot$rosti+rosti
password:
from_secret: repo_password
repo: harbor.hq.rosti.cz
privileged: true
commands:
- make DOCKER=podman VERSION=test test

View File

@ -9,7 +9,7 @@ build:
$(DOCKER) build -t ${REPO}:dev . $(DOCKER) build -t ${REPO}:dev .
test: test:
DOCKER=$(DOCKER) ./tests.sh DOCKER=$(DOCKER) ./tests2.sh
squashed: squashed:
$(DOCKER) pull debian:buster $(DOCKER) pull debian:buster

22
tests2.fish Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/fish
if test -z "$DOCKER"
set DOCKER docker
end
set CONTAINER_NAME dev_test
for line in (cat Dockerfile | grep "RUN build_" | sed "s/RUN build_//" | sed "s/\.sh//" | sed "s/php8/php/")
set tech (string split " " $line)[1]
set tech_version (string split " " $line)[2]
echo "Testing $tech $tech_version"
$DOCKER run -d --rm --name $CONTAINER_NAME harbor.hq.rosti.cz/rosti/runtime:test > /dev/null; or exit 1
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=$tech-$tech_version $CONTAINER_NAME su app -c rosti > /dev/null; or exit 1
sleep 3
$DOCKER exec $CONTAINER_NAME curl --head http://localhost:8000 | grep "HTTP/1.1 200"; or exit 2
$DOCKER stop $CONTAINER_NAME; or exit 1
end