lister.tests: Add missing task_type for package listers

The scheduler module no longer initializes itself those task_type.
This commit is contained in:
Antoine R. Dumont (@ardumont) 2019-11-21 13:33:16 +01:00
parent 5191d291da
commit 1cf7c8e86b
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8
10 changed files with 104 additions and 22 deletions

View file

@ -49,6 +49,7 @@ class GNULister(SimpleLister):
"""
artifacts = self.gnu_tree.artifacts[origin_url]
assert origin_type == 'tar'
return utils.create_task_dict(
'load-%s' % origin_type,
kwargs.get('policy', 'oneshot'),

View file

@ -1 +1,23 @@
# 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
import pytest
from swh.lister.core.tests.conftest import * # noqa
@pytest.fixture
def lister_gnu(swh_listers):
lister = swh_listers['gnu']
# Add the load-deb-package in the scheduler backend
lister.scheduler.create_task_type({
'type': 'load-tar',
'description': 'Load archive files',
'backend_name': 'swh.loader.package.tasks.LoadArchive',
'default_interval': '1 day',
})
return lister

View file

@ -9,12 +9,10 @@ import logging
logger = logging.getLogger(__name__)
def test_gnu_lister(swh_listers, requests_mock_datadir):
lister = swh_listers['gnu']
def test_gnu_lister(lister_gnu, requests_mock_datadir):
lister_gnu.run()
lister.run()
r = lister.scheduler.search_tasks(task_type='load-tar')
r = lister_gnu.scheduler.search_tasks(task_type='load-tar')
assert len(r) == 383
for row in r: