use new retry function; split test into 2

This commit is contained in:
Alexander Tomokhov 2023-12-20 21:43:47 +04:00
parent 4380a733a6
commit 3b4d75bcdb

View file

@ -80,10 +80,11 @@ steps:
from_secret: DOMAIN
TIMEOUT: 100
commands:
- sleep 300
- t0="$(date '+%s')"; until nix shell --inputs-from git+https://git.selfprivacy.org/alexoundos/selfprivacy-tests.git nixpkgs#netcat -c nc -zv -w1 "$DOMAIN" 443; do sleep 10; cur_date="$(date '+%s')"; remaining=$((t0 + TIMEOUT - cur_date)); [ "$remaining" -gt 0 ]; echo "$remaining seconds remain before teardown"; done
- sleep 300
- t0="$(date '+%s')"; until nix shell --inputs-from git+https://git.selfprivacy.org/alexoundos/selfprivacy-tests.git nixpkgs#netcat -c nc -zv -w1 "$DOMAIN" 443; do sleep 10; cur_date="$(date '+%s')"; remaining=$((t0 + TIMEOUT - cur_date)); [ "$remaining" -gt 0 ]; echo "$remaining seconds remain before teardown"; done
- sleep 10
- name: test
- name: basic test
environment:
DOMAIN:
from_secret: DOMAIN
@ -95,15 +96,26 @@ steps:
from_secret: USER_PASS
TESTS_REPO: git+https://git.selfprivacy.org/alexoundos/selfprivacy-tests.git
TIMEOUT_1: 100
commands:
- source $(nix build $TESTS_REPO#library --print-out-paths)/library.sh
- dig api.$DOMAIN
- http -v --verify=false --check-status --ignore-stdin GET https://api.$DOMAIN/services/status Authorization:"Bearer $USER_PASS"
- retry $TIMEOUT_1 10 http -v --verify=false --check-status --ignore-stdin GET https://api.$DOMAIN/services/status Authorization:"Bearer $USER_PASS"
- swaks --to ci@$DOMAIN -s selfprivacy.org -tls -au test@selfprivacy.org -ap $TEST_EMAIL_PASS -ahp
- http -v --verify=false --check-status --ignore-stdin GET https://cloud.$DOMAIN/ocs/v2.php/apps/serverinfo/api/v1/info?format=json -a admin:$USER_PASS
- echo "File to test nextcloud upload" > file
- http -v --verify=false --check-status --ignore-stdin PUT https://cloud.$DOMAIN/remote.php/dav/files/admin/file @file -a admin:$USER_PASS
- http -v --verify=false --check-status --ignore-stdin GET https://cloud.$DOMAIN/remote.php/dav/files/admin/file -a admin:$USER_PASS
#- > #http -v --verify=false --check-status --ignore-stdin GET https://password.$DOMAIN/admin/diagnostics
- name: API & nixos-rebuild test
environment:
DOMAIN:
from_secret: DOMAIN
API_TOKEN:
from_secret: USER_PASS
TESTS_REPO: git+https://git.selfprivacy.org/alexoundos/selfprivacy-tests.git
TIMEOUT_1: 100
commands:
- timer=0; while true; do nix run $TESTS_REPO#query-minimum-services && break; [ "$timer" -lt "$TIMEOUT_1" ]; echo "$((TIMEOUT_1 - timer)) seconds remain for retries"; sleep 10; ((timer+=10)); done
- nix run $TESTS_REPO#enable-service bitwarden
- nix run $TESTS_REPO#enable-service gitea
@ -124,7 +136,6 @@ steps:
- nix run $TESTS_REPO#nixos-rebuild Rebuild
- sleep 60
- timer=0; while true; do nix run $TESTS_REPO#query-all-services && break; [ "$timer" -lt "$TIMEOUT_1" ]; echo "$((TIMEOUT_1 - timer)) seconds remain for retries"; sleep 10; ((timer+=10)); done
#- > #http -v --verify=false --check-status --ignore-stdin GET https://password.$DOMAIN/admin/diagnostics
- name: sleep-after-failure
environment: