Commit 2f604536 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Projects, Runner tests: disable shared and group runners

If regular runners are hooked to the instance being tested,
we must make really sure that our mock runners don't enter a
race with the regular runners.

Sadly, there's no direct API setting for group runners (UPSTREAM)
nor is there a way to block surrounding group runners with
settings in a sub group, so we had to resort to using Selenium
for this.

It is important to not even attempt to disable group runners this
way for personal namespaces, because the button is not present,
leading to an error. It is also faster, because we don't even
need a webdriver to be initialized in this case.

branch : stable
parent b89866c6a137
......@@ -321,6 +321,7 @@ def test_project(heptapod, accepts_concurrent):
def test_project_with_runner(test_project):
with Runner.api_register(test_project, unique_name('fixt')) as runner:
yield test_project, runner
......@@ -4,6 +4,7 @@ from import WebDriverWait
def test_register_grab_job(test_project, tmpdir):
runner = Runner.api_register(test_project, 'test_register')
# registration consistency
......@@ -58,6 +59,7 @@ def test_register_grab_job(test_project, tmpdir):
def test_pipeline_pages(test_project, tmpdir):
with Runner.api_register(test_project, 'test_register') as runner:
# push something and grab a job
repo_path = tmpdir.join('repo1')
repo = LocalRepo.init(repo_path)
......@@ -1151,6 +1151,27 @@ class Project(object):
self._disk_path = None
return resp
def only_specific_runners(self):
resp = self.api_edit(shared_runners_enabled=False)
assert resp.status_code < 400
if resp.json()['namespace']['kind'] != 'group':
driver = self.owner_webdriver
driver.get(self.url + '/-/settings/ci_cd')
elem = driver.find_element_by_xpath(
'//button[contains(text(), "Expand")]'
WebDriverWait(driver, 10).until(
lambda d: d.find_element_by_xpath(
'//a[contains(@href, "/toggle_group_runners")]')))
def api_create_mirror(self, **params):
return ProjectMirror.api_create(self, **params)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment