diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 642225e..26d7eee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/tests/fedeproxy/common/test_gitlab.py b/tests/fedeproxy/common/test_gitlab.py new file mode 100644 index 0000000..ac60e60 --- /dev/null +++ b/tests/fedeproxy/common/test_gitlab.py @@ -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') diff --git a/tests/setup-gitlab.sh b/tests/setup-gitlab.sh index 2075076..024c34a 100755 --- a/tests/setup-gitlab.sh +++ b/tests/setup-gitlab.sh @@ -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 "$@" - diff --git a/tox.ini b/tox.ini index 27b18b1..794935a 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,7 @@ setenv = VIRTUAL_ENV={envdir} DJANGO_SETTINGS_MODULE=fedeproxy.settings passenv = + FEDEPROXY_IP GITLAB_CI PYTEST_ADDOPTS HOME