Skip to content
Snippets Groups Projects
Verified Commit a2771874 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

add-forge-now: Allow scheduling of cgit task type

parent c24b0c85
No related branches found
No related tags found
No related merge requests found
Pipeline #1567 passed
......@@ -65,7 +65,7 @@ def register_lister_cli(
# Map the associated task types for the lister
task_type_names: Dict[str, str] = {
listing_type: lister_task_type(lister_name, listing_type)
for listing_type in ["full", "incremental"]
for listing_type in ["full", "incremental", None]
}
task_types: Dict[str, Dict] = {}
......
# Copyright (C) 2019-2022 The Software Heritage developers
# Copyright (C) 2019 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
......@@ -332,5 +332,10 @@ def task_add(
click.echo("\n".join(output))
def lister_task_type(lister_name: str, lister_type: str) -> str:
return f"list-{lister_name}-{lister_type}"
def lister_task_type(lister_name: str, lister_type: Optional[str] = None) -> str:
"""Compute expected scheduler task type from the lister name and its optional
listing type (full, incremental).
"""
prefix = f"list-{lister_name}"
return f"{prefix}-{lister_type}" if lister_type else prefix
# Copyright (C) 2023 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import pytest
from swh.scheduler.cli.utils import lister_task_type
@pytest.mark.parametrize(
"lister_name, lister_type, expected_task_type",
[
["cgit", None, "list-cgit"],
["gitlab", "full", "list-gitlab-full"],
["gitea", "incremental", "list-gitea-incremental"],
],
)
def test_lister_task_type(lister_name, lister_type, expected_task_type):
assert lister_task_type(lister_name, lister_type) == expected_task_type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment