Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcbc613d

Browse files
nejchJohnVillalovos
authored andcommitted
test(functional): switch to new runner registration API
1 parent41eb95d commitcbc613d

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

‎tests/functional/conftest.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
importtime
99
importuuid
1010
fromsubprocessimportcheck_output
11-
fromtypingimportSequence
11+
fromtypingimportSequence,TYPE_CHECKING
1212

1313
importpytest
1414
importrequests
@@ -260,6 +260,7 @@ def gl(gitlab_url: str, gitlab_token: str) -> gitlab.Gitlab:
260260

261261
logging.info("Instantiating python-gitlab gitlab.Gitlab instance")
262262
instance=gitlab.Gitlab(gitlab_url,private_token=gitlab_token)
263+
instance.auth()
263264

264265
logging.info("Reset GitLab")
265266
reset_gitlab(instance)
@@ -291,33 +292,36 @@ def gitlab_ultimate(gitlab_plan, request) -> None:
291292

292293

293294
@pytest.fixture(scope="session")
294-
defgitlab_runner(gl):
295+
defgitlab_runner(gl:gitlab.Gitlab):
295296
container="gitlab-runner-test"
296-
runner_name="python-gitlab-runner"
297-
token="registration-token"
297+
runner_description="python-gitlab-runner"
298+
ifTYPE_CHECKING:
299+
assertgl.userisnotNone
300+
301+
runner=gl.user.runners.create(
302+
{"runner_type":"instance_type","run_untagged":True}
303+
)
298304
url="http://gitlab"
299305

300306
docker_exec= ["docker","exec",container,"gitlab-runner"]
301307
register= [
302308
"register",
303-
"--run-untagged",
304309
"--non-interactive",
305-
"--registration-token",
306-
token,
307-
"--name",
308-
runner_name,
310+
"--token",
311+
runner.token,
312+
"--description",
313+
runner_description,
309314
"--url",
310315
url,
311316
"--clone-url",
312317
url,
313318
"--executor",
314319
"shell",
315320
]
316-
unregister= ["unregister","--name",runner_name]
317321

318322
yieldcheck_output(docker_exec+register).decode()
319323

320-
check_output(docker_exec+unregister).decode()
324+
gl.runners.delete(token=runner.token)
321325

322326

323327
@pytest.fixture(scope="module")

‎tests/functional/fixtures/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ services:
1212
privileged:true# Just in case https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/1350
1313
environment:
1414
GITLAB_ROOT_PASSWORD:5iveL!fe
15-
GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN:registration-token
1615
GITLAB_OMNIBUS_CONFIG:|
1716
external_url 'http://127.0.0.1:8080'
1817
registry['enable'] =false

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp