gitlab_runner: Fix idempotency when creating runner (#57833)

(cherry picked from commit ec7b18952b)
This commit is contained in:
Guillaume Martinez
2019-06-18 13:12:13 +02:00
committed by Toshio Kuratomi
parent fa6e39ddf2
commit 36df5d22a4
4 changed files with 28 additions and 9 deletions

View File

@ -519,12 +519,12 @@ def resp_delete_project_hook(url, request):
'''
HOOK API
RUNNER API
'''
@urlmatch(scheme="http", netloc="localhost", path="/api/v4/runners/all", method="get")
def resp_find_runners(url, request):
def resp_find_runners_all(url, request):
headers = {'content-type': 'application/json'}
content = ('[{"active": true,"description": "test-1-20150125","id": 1,'
'"is_shared": false,"ip_address": "127.0.0.1","name": null,'
@ -535,6 +535,23 @@ def resp_find_runners(url, request):
return response(200, content, headers, None, 5, request)
@urlmatch(scheme="http", netloc="localhost", path="/api/v4/runners", method="get")
def resp_find_runners_list(url, request):
headers = {'content-type': 'application/json',
"X-Page": 1,
"X-Next-Page": 2,
"X-Per-Page": 1,
"X-Total-Pages": 1,
"X-Total": 2}
content = ('[{"active": true,"description": "test-1-20150125","id": 1,'
'"is_shared": false,"ip_address": "127.0.0.1","name": null,'
'"online": true,"status": "online"},{"active": true,'
'"description": "test-2-20150125","id": 2,"ip_address": "127.0.0.1",'
'"is_shared": false,"name": null,"online": false,"status": "offline"}]')
content = content.encode("utf-8")
return response(200, content, headers, None, 5, request)
@urlmatch(scheme="http", netloc="localhost", path="/api/v4/runners/1", method="get")
def resp_get_runner(url, request):
headers = {'content-type': 'application/json'}