test gitlab

This commit is contained in:
Loic Dachary 2021-01-27 22:15:48 +01:00
parent 36f18bbf10
commit b0bf115f64
No known key found for this signature in database
GPG Key ID: 992D23B392F9E4F2
4 changed files with 16 additions and 9 deletions

View File

@ -4,7 +4,7 @@ jobs:
script:
# - tests/setup-gitlab.sh
- pip install tox
- tox
- FEDEPROXY_IP=$(ip r show default | cut -f3 -d' ') PYTEST_ADDOPTS='-m "not gitlab"' tox
after_script:
- tests/setup-gitlab.sh cleanup

View File

@ -0,0 +1,12 @@
import os
import pytest
from fedeproxy.common.gitlab import GitLab
@pytest.mark.gitlab
def test_recreate_project(tmpdir):
ip = os.environ.get('FEDEPROXY_IP', '0.0.0.0')
gitlab = GitLab(f'http://{ip}:8181')
gitlab.login('root', 'Wrobyak4')
gitlab.recreate_project('root', 'testproject')

View File

@ -58,7 +58,7 @@ function run_gitlab() {
-e GITLAB_SECRETS_OTP_KEY_BASE=4W44tm7bJFRPWNMVzKngffxVWXRpVs49dxhFwgpx7FbCj3wXCMmsz47LzWsdr7nM \
-e GITLAB_ROOT_PASSWORD=Wrobyak4 \
-v $DATA/gitlab$serial/data:/home/git/data \
sameersbn/gitlab
sameersbn/gitlab:13.8.1
}
function main() {
@ -80,14 +80,9 @@ function main() {
run_db $serial
run_gitlab $serial
done
if test "$GITLAB_CI" ; then
IP=$(ip r show default | cut -f3 -d' ')
else
IP=0.0.0.0
fi
for serial in $serials ; do
while true ; do
test $(curl --silent http://$IP:818$serial -o /dev/null -w "%{http_code}") = 302 && break
test $(curl --silent http://${FEDEPROXY_IP:-0.0.0.0}:818$serial -o /dev/null -w "%{http_code}") = 302 && break
sleep 5
done
done
@ -96,4 +91,3 @@ function main() {
}
main "$@"

View File

@ -6,6 +6,7 @@ setenv =
VIRTUAL_ENV={envdir}
DJANGO_SETTINGS_MODULE=fedeproxy.settings
passenv =
FEDEPROXY_IP
GITLAB_CI
PYTEST_ADDOPTS
HOME