gitea/forgejo : premiers tests avec bats

This commit is contained in:
Gitouche 2024-03-10 18:04:00 +01:00
parent 9ee34d8d4b
commit 7d16d3d417
3 changed files with 30 additions and 1 deletions

View file

@ -11,7 +11,7 @@ gitea:
script: script:
- cd podman-gitea - cd podman-gitea
- ./ci_build-images.sh - ./ci_build-images.sh
- GARBAYE_GITEA_DOMAIN=git.garbaye.fr GARBAYE_GITEA_SMTP_FROM='git-ci@garbaye.fr' GARBAYE_GITEA_POSTGRES_PASSWORD=kejfczEAKjzkejklc GARBAYE_GITEA_ENV_WEBLISTENPORT=18088 GARBAYE_GITEA_ENV_SSHLISTENPORT=12222 ./05_freshinstall.sh - GARBAYE_GITEA_DOMAIN=git.garbaye.fr GARBAYE_GITEA_ENV_APPNAME='La forge Garbaye' GARBAYE_GITEA_SMTP_FROM='git-ci@garbaye.fr' GARBAYE_GITEA_POSTGRES_PASSWORD=kejfczEAKjzkejklc GARBAYE_GITEA_ENV_WEBLISTENPORT=18088 GARBAYE_GITEA_ENV_SSHLISTENPORT=12222 ./05_freshinstall.sh
- ./20_enable.sh - ./20_enable.sh
- ./30_start.sh && sleep 10 - ./30_start.sh && sleep 10
- ./40_stop.sh - ./40_stop.sh

View file

@ -71,6 +71,7 @@ podman unshare sed -i '/{{ctx.Locale.Tr \"startpage.platform\"}}/,${s//Quels con
podman unshare sed -i '/{{ctx.Locale.Tr \"startpage.platform_desc\" | Str2html}}/,${s//La forge accueille tout type de contenu tel que code source, documentation, artistique, littéraire, etc. Un usage raisonnable en espace disque est attendu de nos utilisateurs./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl && podman unshare sed -i '/{{ctx.Locale.Tr \"startpage.platform_desc\" | Str2html}}/,${s//La forge accueille tout type de contenu tel que code source, documentation, artistique, littéraire, etc. Un usage raisonnable en espace disque est attendu de nos utilisateurs./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{ctx.Locale.Tr \"startpage.license\"}}/,${s//Licences libres/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl && podman unshare sed -i '/{{ctx.Locale.Tr \"startpage.license\"}}/,${s//Licences libres/;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
podman unshare sed -i '/{{ctx.Locale.Tr \"startpage.license_desc\" | Str2html}}/,${s//Tous les projets présents sur cette forge sont publiés sous licences libres, <a href="https:\/\/www.gnu.org\/licenses\/license-list.fr.html">au sens de la Free Software Foundation<\/a>./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl && podman unshare sed -i '/{{ctx.Locale.Tr \"startpage.license_desc\" | Str2html}}/,${s//Tous les projets présents sur cette forge sont publiés sous licences libres, <a href="https:\/\/www.gnu.org\/licenses\/license-list.fr.html">au sens de la Free Software Foundation<\/a>./;b};$q1' `get_podman_volume_path ${datavolume}`/gitea/templates/home.tmpl &&
bats test/ &&
podman pod stop ${pod_name} && podman pod stop ${pod_name} &&
echo Pod built and stopped. && echo Pod built and stopped. &&
shred -u .env shred -u .env

View file

@ -0,0 +1,28 @@
#!/usr/bin/env bats
@test "[http] Check website is responding" {
run -0 curl -s4I "http://localhost:${weblisten_port}/user/login?redirect_to=/"
echo "${output}" | grep -q 'HTTP/1.1 200 OK'
}
@test "[http] Check website is well configured" {
run -0 curl -s "http://localhost:${weblisten_port}/"
echo "${output}" | grep -q '<title>La forge Garbaye</title>'
}
@test "[gitea] Check gitea doctor for errors" {
skip
run -0 podman container exec --user git gitea gitea doctor check --all
# Run all test but suppress output for gc-lfs
! echo -e "$output" | sed -e '/Garbage collect LFS/,+1d' | grep -q ERROR
}
@test "[ssh] Check OpenSSH is working over IPv4" {
run -0 bash -c "echo '' | nc -4 localhost ${sshlisten_port}"
echo "${output}" | grep -q 'SSH-2.0-OpenSSH'
}
@test "[ssh] Check OpenSSH is working over IPv6" {
run -0 bash -c "echo '' | nc -6 localhost ${sshlisten_port}"
echo "${output}" | grep -q 'SSH-2.0-OpenSSH'
}