Browse Source

gitlab: tests need certs

keep-around/634c0c493aa0deea56b740fb954b25e347c2894c
Loïc Dachary 7 months ago
committed by some
parent
commit
c608707254
Signed by: dachary GPG Key ID: 992D23B392F9E4F2
  1. 3
      enough/common/gitlab.py
  2. 4
      playbooks/gitlab/tests/test_gitlab.py

3
enough/common/gitlab.py

@ -27,6 +27,9 @@ class GitLab(object):
self.s.verify = settings.CERTS_DIR
self.s.api = self.url + '/api/v4'
def certs(self, certs):
self.s.verify = certs
def login(self, username, password):
r = self.s.post(self.url + '/oauth/token', json={
'username': username,

4
playbooks/gitlab/tests/test_gitlab.py

@ -9,7 +9,8 @@ from enough.common.gitlab import GitLab
testinfra_hosts = ['ansible://gitlab-host']
def test_ci_runner(host, tmpdir):
def test_ci_runner(request, host, tmpdir):
certs = request.session.infrastructure.certs()
domain = host.run("hostname -d").stdout.strip()
runner_host = testinfra.host.Host.get_host(
'ansible://runner-host',
@ -17,6 +18,7 @@ def test_ci_runner(host, tmpdir):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
gitlab = GitLab(f'https://lab.{domain}')
gitlab.certs(certs)
gitlab.login('root', gitlab_utils.get_password())
gitlab.recreate_project('root', 'testproject')
runner_host.run("rm -f /tmp/*.out")

Loading…
Cancel
Save