Allow gitlab lister's name to be overriden by task arguments

This will allow to dedicate the heptapod instances into its their own stats.

Related to T3581
This commit is contained in:
Antoine R. Dumont (@ardumont) 2021-09-17 14:27:16 +02:00
parent fdb420238c
commit c803fc2b59
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8
2 changed files with 10 additions and 4 deletions

View file

@ -97,16 +97,17 @@ class GitLabLister(Lister[GitLabListerState, PageResult]):
"""
LISTER_NAME = "gitlab"
def __init__(
self,
scheduler,
url: str,
name: Optional[str] = "gitlab",
instance: Optional[str] = None,
credentials: Optional[CredentialsType] = None,
incremental: bool = False,
):
if name is not None:
self.LISTER_NAME = name
super().__init__(
scheduler=scheduler,
url=url.rstrip("/"),

View file

@ -57,11 +57,16 @@ def test_lister_gitlab(datadir, swh_scheduler, requests_mock):
def test_lister_gitlab_heptapod(datadir, swh_scheduler, requests_mock):
"""Gitlab lister ignores some vcs_type
"""Heptapod lister happily lists hg, hg_git as hg and git origins
"""
name = "heptapod"
instance = "foss.heptapod.net"
lister = GitLabLister(swh_scheduler, url=api_url(instance), instance=instance)
lister = GitLabLister(
swh_scheduler, url=api_url(instance), name=name, instance=instance
)
assert lister.LISTER_NAME == name
response = gitlab_page_response(datadir, instance, 1)
requests_mock.get(