sirmordred 1.0.5rc1__tar.gz → 1.1.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/PKG-INFO +1 -1
  2. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/pyproject.toml +1 -1
  3. sirmordred-1.1.0rc1/sirmordred/_version.py +2 -0
  4. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/sirmordred.py +34 -5
  5. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/task.py +2 -11
  6. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/task_autorefresh.py +2 -2
  7. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/task_enrich.py +2 -2
  8. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/task_identities.py +2 -2
  9. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/task_manager.py +3 -2
  10. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_task.py +19 -13
  11. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_task_autorefresh.py +19 -15
  12. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_task_collection.py +4 -2
  13. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_task_enrich.py +66 -45
  14. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_task_identities.py +21 -10
  15. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_task_manager.py +19 -6
  16. sirmordred-1.0.5rc1/sirmordred/_version.py +0 -2
  17. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/LICENSE +0 -0
  18. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/README.md +0 -0
  19. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/menu.yaml +0 -0
  20. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/__init__.py +0 -0
  21. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/bin/sirmordred.py +0 -0
  22. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/config.py +0 -0
  23. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/error.py +0 -0
  24. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/github.py +0 -0
  25. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/task_collection.py +0 -0
  26. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/task_panels.py +0 -0
  27. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/task_projects.py +0 -0
  28. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/find_affiliation_conflicts.py +0 -0
  29. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/grimoirelab_valid.yml +0 -0
  30. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/healthcheck.py +0 -0
  31. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/logs/all.log +0 -0
  32. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/micro.py +0 -0
  33. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/panels_config.py +0 -0
  34. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/projects.json +0 -0
  35. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/projects_json2yml.py +0 -0
  36. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/sirmordred/utils/setup.cfg +0 -0
  37. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/aliases.json +0 -0
  38. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/askbot.archive +0 -0
  39. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/bugzilla.archive +0 -0
  40. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/bugzillarest.archive +0 -0
  41. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/confluence.archive +0 -0
  42. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/crates.archive +0 -0
  43. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/discourse.archive +0 -0
  44. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/dockerhub.archive +0 -0
  45. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/functest.archive +0 -0
  46. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/gerrit.archive +0 -0
  47. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/github-issue.archive +0 -0
  48. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/github-pull.archive +0 -0
  49. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/gitlab-issue.archive +0 -0
  50. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/gitlab-merge.archive +0 -0
  51. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/googlehits.archive +0 -0
  52. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/jenkins.archive +0 -0
  53. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/jira.archive +0 -0
  54. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/launchpad.archive +0 -0
  55. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/mediawiki-1.23.archive +0 -0
  56. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/mediawiki-1.28.archive +0 -0
  57. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/meetup.archive +0 -0
  58. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/mozillaclub.archive +0 -0
  59. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/nntp.archive +0 -0
  60. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/phabricator.archive +0 -0
  61. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/redmine.archive +0 -0
  62. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/remo.archive +0 -0
  63. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/rss.archive +0 -0
  64. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/slack.archive +0 -0
  65. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/stackexchange.archive +0 -0
  66. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/telegram.archive +0 -0
  67. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives/twitter.archive +0 -0
  68. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives-test-projects.json +0 -0
  69. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/archives-test.cfg +0 -0
  70. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/eclipse-projects.json +0 -0
  71. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/healthcheck_cache_invalid.json +0 -0
  72. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/healthcheck_cache_valid.json +0 -0
  73. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/healthcheck_cache_wrong_key.json +0 -0
  74. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/mordred.log +0 -0
  75. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/orgs_sortinghat.json +0 -0
  76. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/perceval_identities_sortinghat.json +0 -0
  77. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/remote_identities_sortinghat.json +0 -0
  78. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/task-identities-data.json +0 -0
  79. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/task-params-expected +0 -0
  80. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/task-params-test-projects.json +0 -0
  81. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/task-params-test.cfg +0 -0
  82. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/data/url-projects.json +0 -0
  83. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/run_tests.py +0 -0
  84. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/sortinghat_settings.py +0 -0
  85. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test-no-collection.cfg +0 -0
  86. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test-no-sh.cfg +0 -0
  87. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test-projects-no-collection.json +0 -0
  88. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test-projects.json +0 -0
  89. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test-repos-projects.json +0 -0
  90. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test-repos.cfg +0 -0
  91. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test.cfg +0 -0
  92. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_config.py +0 -0
  93. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_github.py +0 -0
  94. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_healthcheck.py +0 -0
  95. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_sirmordred.py +0 -0
  96. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_studies.cfg +0 -0
  97. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_task_panels.py +0 -0
  98. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_task_projects.py +0 -0
  99. {sirmordred-1.0.5rc1 → sirmordred-1.1.0rc1}/tests/test_wrong.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sirmordred
3
- Version: 1.0.5rc1
3
+ Version: 1.1.0rc1
4
4
  Summary: Drive GrimoireLab tools to produce a dashboard
5
5
  Home-page: https://chaoss.github.io/grimoirelab/
6
6
  License: GPL-3.0+
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "sirmordred"
3
- version = "1.0.5-rc.1"
3
+ version = "1.1.0-rc.1"
4
4
  description = "Drive GrimoireLab tools to produce a dashboard"
5
5
  authors = [
6
6
  "GrimoireLab Developers"
@@ -0,0 +1,2 @@
1
+ # File auto-generated by semverup on 2024-08-30 15:37:15.309385
2
+ __version__ = "1.1.0-rc.1"
@@ -50,6 +50,7 @@ from sirmordred.task_identities import TaskIdentitiesMerge
50
50
  from sirmordred.task_manager import TasksManager
51
51
  from sirmordred.task_panels import TaskPanels, TaskPanelsMenu
52
52
  from sirmordred.task_projects import TaskProjects
53
+ from sortinghat.cli.client import SortingHatClient
53
54
 
54
55
  logger = logging.getLogger(__name__)
55
56
 
@@ -198,7 +199,7 @@ class SirMordred:
198
199
  repos_backend = self._get_repos_by_backend()
199
200
  for backend in repos_backend:
200
201
  # Start new Threads and add them to the threads list to complete
201
- t = TasksManager(backend_tasks, backend, stopper, self.config, small_delay)
202
+ t = TasksManager(backend_tasks, backend, stopper, self.config, self.client, small_delay)
202
203
  threads.append(t)
203
204
  t.start()
204
205
 
@@ -206,7 +207,7 @@ class SirMordred:
206
207
  if len(global_tasks) > 0:
207
208
  # FIXME timer is applied to all global_tasks, does it make sense?
208
209
  # All tasks are executed in the same thread sequentially
209
- gt = TasksManager(global_tasks, "Global tasks", stopper, self.config, big_delay)
210
+ gt = TasksManager(global_tasks, "Global tasks", stopper, self.config, self.client, big_delay)
210
211
  threads.append(gt)
211
212
  gt.start()
212
213
  if big_delay > 0:
@@ -248,14 +249,14 @@ class SirMordred:
248
249
  if self.conf['phases']['panels']:
249
250
  tasks = [TaskPanels, TaskPanelsMenu]
250
251
  stopper.set()
251
- tm = TasksManager(tasks, "Global tasks", stopper, self.config)
252
+ tm = TasksManager(tasks, "Global tasks", stopper, self.config, self.client)
252
253
  tm.start()
253
254
  tm.join()
254
255
 
255
256
  logger.info("Loading projects")
256
257
  tasks = [TaskProjects]
257
258
  stopper.set()
258
- tm = TasksManager(tasks, "Global tasks", stopper, self.config)
259
+ tm = TasksManager(tasks, "Global tasks", stopper, self.config, self.client)
259
260
  tm.start()
260
261
  tm.join()
261
262
  logger.info("Projects loaded")
@@ -280,7 +281,7 @@ class SirMordred:
280
281
 
281
282
  # check we have access to the needed ES
282
283
  if not self.check_es_access():
283
- print('Can not access Elasticsearch service. Exiting sirmordred ...')
284
+ print('Can not access ElasticSearch/OpenSearch service. Exiting sirmordred ...')
284
285
  sys.exit(1)
285
286
 
286
287
  # If bestiary is configured check that it is working
@@ -289,6 +290,9 @@ class SirMordred:
289
290
  print('Can not access bestiary service. Exiting sirmordred ...')
290
291
  sys.exit(1)
291
292
 
293
+ # Create SortingHat Client
294
+ self.__create_sh_client(self.config)
295
+
292
296
  # Initial round: panels and projects loading
293
297
  self.__execute_initial_load()
294
298
 
@@ -336,3 +340,28 @@ class SirMordred:
336
340
  logger.error(var)
337
341
 
338
342
  logger.info("Finished SirMordred engine ...")
343
+
344
+ def __create_sh_client(self, config):
345
+ self.config = config
346
+ self.conf = config.get_conf()
347
+
348
+ sortinghat = self.conf.get('sortinghat', None)
349
+ self.db_sh = sortinghat['database'] if sortinghat else None
350
+ self.db_user = sortinghat['user'] if sortinghat else None
351
+ self.db_password = sortinghat['password'] if sortinghat else None
352
+ self.db_host = sortinghat['host'] if sortinghat else '127.0.0.1'
353
+ self.db_path = sortinghat.get('path', None) if sortinghat else None
354
+ self.db_port = sortinghat.get('port', None) if sortinghat else None
355
+ self.db_ssl = sortinghat.get('ssl', False) if sortinghat else False
356
+ self.db_verify_ssl = sortinghat.get('verify_ssl', True) if sortinghat else True
357
+ self.db_tenant = sortinghat.get('tenant', True) if sortinghat else None
358
+ self.db_unaffiliate_group = sortinghat['unaffiliated_group'] if sortinghat else None
359
+ if sortinghat and not hasattr(self, 'client'):
360
+ self.client = SortingHatClient(host=self.db_host, port=self.db_port,
361
+ path=self.db_path, ssl=self.db_ssl,
362
+ user=self.db_user, password=self.db_password,
363
+ verify_ssl=self.db_verify_ssl,
364
+ tenant=self.db_tenant)
365
+ self.client.connect()
366
+ elif not sortinghat:
367
+ self.client = None
@@ -29,7 +29,6 @@ import re
29
29
  from grimoire_elk.elk import get_ocean_backend
30
30
  from grimoire_elk.utils import get_connector_from_name, get_elastic
31
31
  from grimoire_elk.enriched.utils import grimoire_con
32
- from sortinghat.cli.client import SortingHatClient
33
32
 
34
33
  logger = logging.getLogger(__name__)
35
34
 
@@ -42,10 +41,11 @@ class Task():
42
41
  'studies', 'node_regex', 'anonymize']
43
42
  PARAMS_WITH_SPACES = ['blacklist-jobs']
44
43
 
45
- def __init__(self, config):
44
+ def __init__(self, config, sortinghat_client=None):
46
45
  self.backend_section = None
47
46
  self.config = config
48
47
  self.conf = config.get_conf()
48
+ self.client = sortinghat_client
49
49
 
50
50
  sortinghat = self.conf.get('sortinghat', None)
51
51
  self.db_sh = sortinghat['database'] if sortinghat else None
@@ -58,15 +58,6 @@ class Task():
58
58
  self.db_verify_ssl = sortinghat.get('verify_ssl', True) if sortinghat else True
59
59
  self.db_tenant = sortinghat.get('tenant', True) if sortinghat else None
60
60
  self.db_unaffiliate_group = sortinghat['unaffiliated_group'] if sortinghat else None
61
- if sortinghat:
62
- self.client = SortingHatClient(host=self.db_host, port=self.db_port,
63
- path=self.db_path, ssl=self.db_ssl,
64
- user=self.db_user, password=self.db_password,
65
- verify_ssl=self.db_verify_ssl,
66
- tenant=self.db_tenant)
67
- self.client.connect()
68
- else:
69
- self.client = None
70
61
 
71
62
  self.grimoire_con = grimoire_con(conn_retries=12) # 30m retry
72
63
 
@@ -43,8 +43,8 @@ logger = logging.getLogger(__name__)
43
43
  class TaskAutorefresh(Task):
44
44
  """Refresh the last modified identities for all the backends."""
45
45
 
46
- def __init__(self, config):
47
- super().__init__(config)
46
+ def __init__(self, config, sortinghat_client):
47
+ super().__init__(config, sortinghat_client)
48
48
 
49
49
  self.last_autorefresh_backend = {}
50
50
 
@@ -53,8 +53,8 @@ logger = logging.getLogger(__name__)
53
53
  class TaskEnrich(Task):
54
54
  """ Basic class shared by all enriching tasks """
55
55
 
56
- def __init__(self, config, backend_section=None, allowed_repos=None):
57
- super().__init__(config)
56
+ def __init__(self, config, sortinghat_client, backend_section=None, allowed_repos=None):
57
+ super().__init__(config, sortinghat_client)
58
58
  self.backend_section = backend_section
59
59
  self.allowed_repos = set(allowed_repos) if allowed_repos else None
60
60
  # This will be options in next iteration
@@ -38,8 +38,8 @@ logger = logging.getLogger(__name__)
38
38
  class TaskIdentitiesMerge(Task):
39
39
  """ Task for processing identities in SortingHat """
40
40
 
41
- def __init__(self, conf):
42
- super().__init__(conf)
41
+ def __init__(self, conf, soringhat_client):
42
+ super().__init__(conf, soringhat_client)
43
43
  self.last_autorefresh = datetime.utcnow() # Last autorefresh date
44
44
 
45
45
  def is_backend_task(self):
@@ -50,7 +50,7 @@ class TasksManager(threading.Thread):
50
50
  IDENTITIES_TASKS_ON_LOCK = threading.Lock()
51
51
  IDENTITIES_TASKS_ON = False
52
52
 
53
- def __init__(self, tasks_cls, backend_section, stopper, config, timer=0):
53
+ def __init__(self, tasks_cls, backend_section, stopper, config, sortinghat_client, timer=0):
54
54
  """
55
55
  :tasks_cls : tasks classes to be executed using the backend
56
56
  :backend_section: perceval backend section name
@@ -64,6 +64,7 @@ class TasksManager(threading.Thread):
64
64
  self.stopper = stopper # To stop the thread from parent
65
65
  self.timer = timer
66
66
  self.thread_id = None
67
+ self.client = sortinghat_client
67
68
 
68
69
  def add_task(self, task):
69
70
  self.tasks.append(task)
@@ -80,7 +81,7 @@ class TasksManager(threading.Thread):
80
81
  logger.debug(self.tasks_cls)
81
82
  for tc in self.tasks_cls:
82
83
  # create the real Task from the class
83
- task = tc(self.config)
84
+ task = tc(self.config, self.client)
84
85
  task.set_backend_section(self.backend_section)
85
86
  self.tasks.append(task)
86
87
 
@@ -33,6 +33,8 @@ sys.path.insert(0, '..')
33
33
  from sirmordred.config import Config
34
34
  from sirmordred.task import Task
35
35
 
36
+ from sortinghat.cli.client import SortingHatClient
37
+
36
38
  CONF_FILE = 'test.cfg'
37
39
  BACKEND_NAME = 'stackexchange'
38
40
  COLLECTION_URL_STACKEXCHANGE = 'http://127.0.0.1:9200'
@@ -47,14 +49,23 @@ def read_file(filename, mode='r'):
47
49
 
48
50
  class TestTask(unittest.TestCase):
49
51
  """Task tests"""
52
+ def setUp(self):
53
+ self.config = Config(CONF_FILE)
54
+ self.conf = self.config.get_conf()
55
+ sh = self.conf.get('sortinghat')
56
+ self.sortinghat_client = SortingHatClient(host=sh['host'], port=sh.get('port', None),
57
+ path=sh.get('path', None), ssl=sh.get('ssl', False),
58
+ user=sh['user'], password=sh['password'],
59
+ verify_ssl=sh.get('verify_ssl', True),
60
+ tenant=sh.get('tenant', True))
61
+ self.sortinghat_client.connect()
50
62
 
51
63
  def test_initialization(self):
52
64
  """Test whether attributes are initializated"""
53
65
 
54
- config = Config(CONF_FILE)
55
- task = Task(config)
66
+ task = Task(self.config, self.sortinghat_client)
56
67
 
57
- self.assertEqual(task.config, config)
68
+ self.assertEqual(task.config, self.config)
58
69
  self.assertEqual(task.db_sh, task.conf['sortinghat']['database'])
59
70
  self.assertEqual(task.db_user, task.conf['sortinghat']['user'])
60
71
  self.assertEqual(task.db_password, task.conf['sortinghat']['password'])
@@ -63,15 +74,13 @@ class TestTask(unittest.TestCase):
63
74
  def test_run(self):
64
75
  """Test whether the Task could be run"""
65
76
 
66
- config = Config(CONF_FILE)
67
- task = Task(config)
77
+ task = Task(self.config, self.sortinghat_client)
68
78
  self.assertEqual(task.execute(), None)
69
79
 
70
80
  def test_compose_p2o_params(self):
71
81
  """Test whether p2o params are built correctly for a backend and a repository"""
72
82
 
73
- config = Config(CONF_FILE)
74
- task = Task(config)
83
+ task = Task(self.config, self.sortinghat_client)
75
84
  params = task._compose_p2o_params("stackexchange", "https://stackoverflow.com/questions/tagged/example")
76
85
  self.assertDictEqual(params, {'url': "https://stackoverflow.com/questions/tagged/example"})
77
86
 
@@ -92,8 +101,7 @@ class TestTask(unittest.TestCase):
92
101
  def test_extract_repo_tags(self):
93
102
  """Test the extraction of tags in repositories"""
94
103
 
95
- config = Config(CONF_FILE)
96
- task = Task(config)
104
+ task = Task(self.config, self.sortinghat_client)
97
105
  url, tags = task._extract_repo_tags("git", "https://github.com/zhquan_example/repo --labels=[ENG, SUPP]")
98
106
  self.assertEqual(url, "https://github.com/zhquan_example/repo")
99
107
  self.assertListEqual(tags, ["ENG", "SUPP"])
@@ -113,8 +121,7 @@ class TestTask(unittest.TestCase):
113
121
 
114
122
  expected_repo_params = json.loads(read_file('data/task-params-expected'))
115
123
 
116
- config = Config(CONF_FILE)
117
- task = Task(config)
124
+ task = Task(self.config, self.sortinghat_client)
118
125
 
119
126
  for backend in expected_repo_params.keys():
120
127
  repo = expected_repo_params.get(backend)['repo']
@@ -126,8 +133,7 @@ class TestTask(unittest.TestCase):
126
133
  def test_get_collection_url(self):
127
134
  """Test whether the collection url could be overwritten in a backend"""
128
135
 
129
- config = Config(CONF_FILE)
130
- task = Task(config)
136
+ task = Task(self.config, self.sortinghat_client)
131
137
  task.backend_section = "stackexchange"
132
138
 
133
139
  self.assertEqual(task._get_collection_url(), COLLECTION_URL_STACKEXCHANGE)
@@ -39,7 +39,7 @@ from sirmordred.task_collection import TaskRawDataCollection
39
39
  from sirmordred.task_enrich import TaskEnrich
40
40
  from sirmordred.task_projects import TaskProjects
41
41
 
42
- from sortinghat.cli.client import SortingHatSchema
42
+ from sortinghat.cli.client import SortingHatClient, SortingHatSchema
43
43
 
44
44
  from sgqlc.operation import Operation
45
45
 
@@ -131,8 +131,16 @@ class TestTaskAutorefresh(unittest.TestCase):
131
131
  client.execute(op)
132
132
 
133
133
  def setUp(self):
134
- config = Config(CONF_FILE)
135
- task = TaskAutorefresh(config)
134
+ self.config = Config(CONF_FILE)
135
+ self.conf = self.config.get_conf()
136
+ sh = self.conf.get('sortinghat')
137
+ self.sortinghat_client = SortingHatClient(host=sh['host'], port=sh.get('port', None),
138
+ path=sh.get('path', None), ssl=sh.get('ssl', False),
139
+ user=sh['user'], password=sh['password'],
140
+ verify_ssl=sh.get('verify_ssl', True),
141
+ tenant=sh.get('tenant', True))
142
+ self.sortinghat_client.connect()
143
+ task = TaskAutorefresh(self.config, self.sortinghat_client)
136
144
 
137
145
  # Clean database
138
146
  entities = SortingHat.unique_identities(task.client)
@@ -162,16 +170,14 @@ class TestTaskAutorefresh(unittest.TestCase):
162
170
  def test_initialization(self):
163
171
  """Test whether attributes are initialized"""
164
172
 
165
- config = Config(CONF_FILE)
166
- task = TaskAutorefresh(config)
173
+ task = TaskAutorefresh(self.config, self.sortinghat_client)
167
174
 
168
- self.assertEqual(task.config, config)
175
+ self.assertEqual(task.config, self.config)
169
176
 
170
177
  def test_is_backend_task(self):
171
178
  """Test whether the Task is not a backend task"""
172
179
 
173
- config = Config(CONF_FILE)
174
- task = TaskAutorefresh(config)
180
+ task = TaskAutorefresh(self.config, self.sortinghat_client)
175
181
 
176
182
  self.assertFalse(task.is_backend_task())
177
183
 
@@ -179,18 +185,16 @@ class TestTaskAutorefresh(unittest.TestCase):
179
185
  """Test whether the Task could be run"""
180
186
 
181
187
  # Create a raw and enriched indexes
182
- config = Config(CONF_FILE)
183
-
184
- TaskProjects(config).execute()
188
+ TaskProjects(self.config, self.sortinghat_client).execute()
185
189
  backend_section = GIT_BACKEND_SECTION
186
190
 
187
- task_collection = TaskRawDataCollection(config, backend_section=backend_section)
191
+ task_collection = TaskRawDataCollection(self.config, backend_section=backend_section)
188
192
  task_collection.execute()
189
193
 
190
- task_enrich = TaskEnrich(config, backend_section=backend_section)
194
+ task_enrich = TaskEnrich(self.config, self.sortinghat_client, backend_section=backend_section)
191
195
  task_enrich.execute()
192
196
 
193
- task_autorefresh = TaskAutorefresh(config)
197
+ task_autorefresh = TaskAutorefresh(self.config, self.sortinghat_client)
194
198
  task_autorefresh.config.set_param('es_enrichment', 'autorefresh', True)
195
199
  # This does nothing because it uses now as from_date:
196
200
  task_autorefresh.execute()
@@ -205,7 +209,7 @@ class TestTaskAutorefresh(unittest.TestCase):
205
209
  self.assertIsNone(task_autorefresh.execute())
206
210
 
207
211
  # Check that the autorefresh went well
208
- cfg = config.get_conf()
212
+ cfg = self.conf
209
213
  es_enrichment = cfg['es_enrichment']['url']
210
214
  enrich_index = es_enrichment + "/" + cfg[GIT_BACKEND_SECTION]['enriched_index']
211
215
 
@@ -111,7 +111,8 @@ class TestTaskRawDataCollection(unittest.TestCase):
111
111
  raw_index = es_collection + "/" + cfg[GIT_BACKEND_SECTION]['raw_index']
112
112
 
113
113
  r = requests.get(raw_index + "/_search?size=0", verify=False)
114
- raw_items = r.json()['hits']['total']
114
+ total = r.json()['hits']['total']
115
+ raw_items = total['value'] if isinstance(total, dict) else total
115
116
  self.assertEqual(raw_items, 3603)
116
117
 
117
118
  def test_execute_no_collection(self):
@@ -130,7 +131,8 @@ class TestTaskRawDataCollection(unittest.TestCase):
130
131
  raw_index = es_collection + "/" + cfg[GIT_BACKEND_SECTION]['raw_index']
131
132
 
132
133
  r = requests.get(raw_index + "/_search?size=0", verify=False)
133
- raw_items = r.json()['hits']['total']
134
+ total = r.json()['hits']['total']
135
+ raw_items = total['value'] if isinstance(total, dict) else total
134
136
  self.assertEqual(raw_items, 40)
135
137
 
136
138
  def test_execute_filter_no_collection(self):
@@ -40,7 +40,7 @@ from sirmordred.task_projects import TaskProjects
40
40
  from sirmordred.task_collection import TaskRawDataCollection
41
41
  from sirmordred.task_enrich import TaskEnrich
42
42
 
43
- from sortinghat.cli.client import (SortingHatSchema)
43
+ from sortinghat.cli.client import SortingHatClient, SortingHatSchema
44
44
 
45
45
  from sgqlc.operation import Operation
46
46
 
@@ -62,6 +62,21 @@ def read_file(filename, mode='r'):
62
62
  class TestTaskEnrich(unittest.TestCase):
63
63
  """Task tests"""
64
64
 
65
+ def _setup(self, conf_file):
66
+ self.config = Config(conf_file)
67
+ self.conf = self.config.get_conf()
68
+ sh = self.conf.get('sortinghat', None)
69
+ if sh:
70
+ self.sortinghat_client = SortingHatClient(host=sh['host'], port=sh.get('port', None),
71
+ path=sh.get('path', None), ssl=sh.get('ssl', False),
72
+ user=sh['user'], password=sh['password'],
73
+ verify_ssl=sh.get('verify_ssl', True),
74
+ tenant=sh.get('tenant', True))
75
+ self.sortinghat_client.connect()
76
+ else:
77
+
78
+ self.sortinghat_client = None
79
+
65
80
  @staticmethod
66
81
  def get_organizations(task):
67
82
  args = {
@@ -91,8 +106,8 @@ class TestTaskEnrich(unittest.TestCase):
91
106
  task.client.execute(op)
92
107
 
93
108
  def setUp(self):
94
- config = Config(CONF_FILE)
95
- task = TaskEnrich(config)
109
+ self._setup(CONF_FILE)
110
+ task = TaskEnrich(self.config, self.sortinghat_client)
96
111
 
97
112
  # Clean database
98
113
  # Remove identities
@@ -112,18 +127,18 @@ class TestTaskEnrich(unittest.TestCase):
112
127
  def test_initialization(self):
113
128
  """Test whether attributes are initializated"""
114
129
 
115
- config = Config(CONF_FILE)
130
+ self._setup(CONF_FILE)
116
131
  backend_section = GIT_BACKEND_SECTION
117
- task = TaskEnrich(config, backend_section=backend_section)
132
+ task = TaskEnrich(self.config, self.sortinghat_client, backend_section=backend_section)
118
133
 
119
- self.assertEqual(task.config, config)
134
+ self.assertEqual(task.config, self.config)
120
135
  self.assertEqual(task.backend_section, backend_section)
121
136
 
122
137
  def test_select_aliases(self):
123
- config = Config(CONF_FILE)
124
- cfg = config.get_conf()
138
+ self._setup(CONF_FILE)
139
+ cfg = self.conf
125
140
  # We need to load the projects
126
- task = TaskEnrich(config)
141
+ task = TaskEnrich(self.config, self.sortinghat_client)
127
142
  expected_aliases = [
128
143
  'git',
129
144
  'git_author',
@@ -135,8 +150,9 @@ class TestTaskEnrich(unittest.TestCase):
135
150
 
136
151
  def test_retain_identities(self):
137
152
  """"""
138
- config = Config(CONF_FILE)
139
- cfg = config.get_conf()
153
+
154
+ self._setup(CONF_FILE)
155
+ cfg = self.conf
140
156
 
141
157
  # Remove old enriched index
142
158
  es_enrichment = cfg['es_enrichment']['url']
@@ -144,15 +160,15 @@ class TestTaskEnrich(unittest.TestCase):
144
160
  requests.delete(enrich_index, verify=False)
145
161
 
146
162
  # We need to load the projects
147
- TaskProjects(config).execute()
163
+ TaskProjects(self.config, self.sortinghat_client).execute()
148
164
  backend_section = GIT_BACKEND_SECTION
149
165
 
150
166
  # Create raw data
151
- task_collection = TaskRawDataCollection(config, backend_section=backend_section)
167
+ task_collection = TaskRawDataCollection(self.config, backend_section=backend_section)
152
168
  task_collection.execute()
153
169
 
154
170
  # Create enriched data
155
- task = TaskEnrich(config, backend_section=backend_section)
171
+ task = TaskEnrich(self.config, self.sortinghat_client, backend_section=backend_section)
156
172
  self.assertEqual(task.execute(), None)
157
173
 
158
174
  entities_before = SortingHat.unique_identities(task.client)
@@ -176,25 +192,25 @@ class TestTaskEnrich(unittest.TestCase):
176
192
  self.assertGreater(len(entities_before), len(entities_after))
177
193
 
178
194
  def test_execute_retain_data(self):
179
- config = Config(CONF_FILE)
180
- cfg = config.get_conf()
195
+ self._setup(CONF_FILE)
196
+ cfg = self.conf
181
197
  # We need to load the projects
182
- TaskProjects(config).execute()
198
+ TaskProjects(self.config, self.sortinghat_client).execute()
183
199
  backend_section = GIT_BACKEND_SECTION
184
200
  # Create raw data
185
- task_collection = TaskRawDataCollection(config, backend_section=backend_section)
201
+ task_collection = TaskRawDataCollection(self.config, backend_section=backend_section)
186
202
  task_collection.execute()
187
203
 
188
204
  # Test enriched data
189
- task = TaskEnrich(config, backend_section=backend_section)
205
+ task = TaskEnrich(self.config, self.sortinghat_client, backend_section=backend_section)
190
206
  task.execute()
191
207
 
192
208
  es_enrichment = cfg['es_enrichment']['url']
193
209
  enrich_index = es_enrichment + "/" + cfg[GIT_BACKEND_SECTION]['enriched_index']
194
210
 
195
211
  r = requests.get(enrich_index + "/_search?size=0", verify=False)
196
- enriched_items_before = r.json()['hits']['total']
197
- # enriched_items_before = r.json()['hits']['total']['value']
212
+ total = r.json()['hits']['total']
213
+ enriched_items_before = total['value'] if isinstance(total, dict) else total
198
214
 
199
215
  # 1 year
200
216
  retention_time = 525600
@@ -202,26 +218,26 @@ class TestTaskEnrich(unittest.TestCase):
202
218
  task.execute()
203
219
 
204
220
  r = requests.get(enrich_index + "/_search?size=0", verify=False)
205
- enriched_items_after = r.json()['hits']['total']
206
- # enriched_items_after = r.json()['hits']['total']['value']
221
+ total = r.json()['hits']['total']
222
+ enriched_items_after = total['value'] if isinstance(total, dict) else total
207
223
 
208
224
  self.assertGreater(enriched_items_before, enriched_items_after)
209
225
 
210
226
  def test_execute(self):
211
227
  """Test whether the Task could be run"""
212
228
 
213
- config = Config(CONF_FILE)
214
- cfg = config.get_conf()
229
+ self._setup(CONF_FILE)
230
+ cfg = self.conf
215
231
  # We need to load the projects
216
- TaskProjects(config).execute()
232
+ TaskProjects(self.config, self.sortinghat_client).execute()
217
233
  backend_section = GIT_BACKEND_SECTION
218
234
 
219
235
  # Create raw data
220
- task_collection = TaskRawDataCollection(config, backend_section=backend_section)
236
+ task_collection = TaskRawDataCollection(self.config, backend_section=backend_section)
221
237
  task_collection.execute()
222
238
 
223
239
  # Test enriched data
224
- task = TaskEnrich(config, backend_section=backend_section)
240
+ task = TaskEnrich(self.config, self.sortinghat_client, backend_section=backend_section)
225
241
  self.assertEqual(task.execute(), None)
226
242
 
227
243
  # Check that the enrichment went well
@@ -231,27 +247,29 @@ class TestTaskEnrich(unittest.TestCase):
231
247
  enrich_index = es_enrichment + "/" + cfg[GIT_BACKEND_SECTION]['enriched_index']
232
248
 
233
249
  r = requests.get(raw_index + "/_search?size=0", verify=False)
234
- raw_items = r.json()['hits']['total']
250
+ total = r.json()['hits']['total']
251
+ raw_items = total['value'] if isinstance(total, dict) else total
235
252
  r = requests.get(enrich_index + "/_search?size=0", verify=False)
236
- enriched_items = r.json()['hits']['total']
253
+ total = r.json()['hits']['total']
254
+ enriched_items = total['value'] if isinstance(total, dict) else total
237
255
 
238
256
  self.assertEqual(raw_items, enriched_items)
239
257
 
240
258
  def test_execute_no_sh(self):
241
259
  """Test whether the Task could be run without SortingHat"""
242
260
 
243
- config = Config(CONF_FILE_NO_SH)
244
- cfg = config.get_conf()
261
+ self._setup(CONF_FILE_NO_SH)
262
+ cfg = self.conf
245
263
  # We need to load the projects
246
- TaskProjects(config).execute()
264
+ TaskProjects(self.config, self.sortinghat_client).execute()
247
265
  backend_section = GIT_BACKEND_SECTION
248
266
 
249
267
  # Create raw data
250
- task_collection = TaskRawDataCollection(config, backend_section=backend_section)
268
+ task_collection = TaskRawDataCollection(self.config, backend_section=backend_section)
251
269
  task_collection.execute()
252
270
 
253
271
  # Test enriched data
254
- task = TaskEnrich(config, backend_section=backend_section)
272
+ task = TaskEnrich(self.config, self.sortinghat_client, backend_section=backend_section)
255
273
  self.assertEqual(task.execute(), None)
256
274
 
257
275
  # Check that the enrichment went well
@@ -261,20 +279,23 @@ class TestTaskEnrich(unittest.TestCase):
261
279
  enrich_index = es_enrichment + "/" + cfg[GIT_BACKEND_SECTION]['enriched_index']
262
280
 
263
281
  r = requests.get(raw_index + "/_search?size=0", verify=False)
264
- raw_items = r.json()['hits']['total']
282
+ total = r.json()['hits']['total']
283
+ raw_items = total['value'] if isinstance(total, dict) else total
284
+
265
285
  r = requests.get(enrich_index + "/_search?size=0", verify=False)
266
- enriched_items = r.json()['hits']['total']
286
+ total = r.json()['hits']['total']
287
+ enriched_items = total['value'] if isinstance(total, dict) else total
267
288
 
268
289
  self.assertEqual(raw_items, enriched_items)
269
290
 
270
291
  def test_studies(self):
271
292
  """Test whether the studies configuration works """
272
- config = Config(CONF_FILE)
273
- cfg = config.get_conf()
293
+ self._setup(CONF_FILE)
294
+ cfg = self.conf
274
295
  # We need to load the projects
275
- TaskProjects(config).execute()
296
+ TaskProjects(self.config, self.sortinghat_client).execute()
276
297
  backend_section = GIT_BACKEND_SECTION
277
- task = TaskEnrich(config, backend_section=backend_section)
298
+ task = TaskEnrich(self.config, self.sortinghat_client, backend_section=backend_section)
278
299
 
279
300
  # Configure no studies
280
301
  cfg.set_param('git', 'studies', None)
@@ -311,7 +332,7 @@ class TestTaskEnrich(unittest.TestCase):
311
332
 
312
333
  # proj_file -> 'test-projects-archive.json' stored within the conf file
313
334
  conf_file = 'archives-test.cfg'
314
- config = Config(conf_file)
335
+ self._setup(conf_file)
315
336
 
316
337
  backend_sections = ['askbot', 'bugzilla', 'bugzillarest', 'confluence',
317
338
  'discourse', 'dockerhub', 'gerrit', 'github:issue', 'github:pull',
@@ -320,13 +341,13 @@ class TestTaskEnrich(unittest.TestCase):
320
341
  'redmine', 'remo', 'rss', 'stackexchange', 'slack', 'telegram', 'twitter']
321
342
 
322
343
  # We need to load the projects
323
- TaskProjects(config).execute()
344
+ TaskProjects(self.config, self.sortinghat_client).execute()
324
345
  for backend_section in backend_sections:
325
- task = TaskRawDataCollection(config, backend_section=backend_section)
346
+ task = TaskRawDataCollection(self.config, backend_section=backend_section)
326
347
  task.execute()
327
348
 
328
349
  for backend_section in backend_sections:
329
- task = TaskEnrich(config, backend_section=backend_section)
350
+ task = TaskEnrich(self.config, self.sortinghat_client, backend_section=backend_section)
330
351
  self.assertEqual(task.execute(), None)
331
352
 
332
353
 
@@ -37,7 +37,7 @@ from grimoire_elk.enriched.sortinghat_gelk import SortingHat
37
37
  from sirmordred.config import Config
38
38
  from sirmordred.task_identities import TaskIdentitiesMerge
39
39
 
40
- from sortinghat.cli.client import SortingHatSchema
40
+ from sortinghat.cli.client import SortingHatClient, SortingHatSchema
41
41
 
42
42
 
43
43
  CONF_FILE = 'test.cfg'
@@ -55,6 +55,17 @@ def read_file(filename, mode='r'):
55
55
  class TestTaskIdentitiesMerge(unittest.TestCase):
56
56
  """Task tests"""
57
57
 
58
+ def _setup(self, conf_file):
59
+ self.config = Config(conf_file)
60
+ self.conf = self.config.get_conf()
61
+ sh = self.conf.get('sortinghat')
62
+ self.sortinghat_client = SortingHatClient(host=sh['host'], port=sh.get('port', None),
63
+ path=sh.get('path', None), ssl=sh.get('ssl', False),
64
+ user=sh['user'], password=sh['password'],
65
+ verify_ssl=sh.get('verify_ssl', True),
66
+ tenant=sh.get('tenant', True))
67
+ self.sortinghat_client.connect()
68
+
58
69
  @staticmethod
59
70
  def get_organizations(task):
60
71
  args = {
@@ -105,8 +116,8 @@ class TestTaskIdentitiesMerge(unittest.TestCase):
105
116
  task.client.execute(op)
106
117
 
107
118
  def setUp(self):
108
- config = Config(CONF_FILE)
109
- task = TaskIdentitiesMerge(config)
119
+ self._setup(CONF_FILE)
120
+ task = TaskIdentitiesMerge(self.config, self.sortinghat_client)
110
121
 
111
122
  # Clean database
112
123
  # Remove identities
@@ -137,20 +148,20 @@ class TestTaskIdentitiesMerge(unittest.TestCase):
137
148
  def test_initialization(self):
138
149
  """Test whether attributes are initializated"""
139
150
 
140
- config = Config(CONF_FILE)
141
- task = TaskIdentitiesMerge(config)
151
+ self._setup(CONF_FILE)
152
+ task = TaskIdentitiesMerge(self.config, self.sortinghat_client)
142
153
 
143
- self.assertEqual(task.config, config)
154
+ self.assertEqual(task.config, self.config)
144
155
 
145
156
  def test_is_backend_task(self):
146
- config = Config(CONF_FILE)
147
- task = TaskIdentitiesMerge(config)
157
+ self._setup(CONF_FILE)
158
+ task = TaskIdentitiesMerge(self.config, self.sortinghat_client)
148
159
 
149
160
  self.assertFalse(task.is_backend_task())
150
161
 
151
162
  def test_execute(self):
152
- config = Config(CONF_FILE)
153
- task = TaskIdentitiesMerge(config)
163
+ self._setup(CONF_FILE)
164
+ task = TaskIdentitiesMerge(self.config, self.sortinghat_client)
154
165
 
155
166
  self.assertIsNone(task.execute())
156
167
  args = {
@@ -34,6 +34,8 @@ from sirmordred.task_collection import TaskRawDataCollection
34
34
  from sirmordred.task_enrich import TaskEnrich
35
35
  from sirmordred.task_projects import TaskProjects
36
36
 
37
+ from sortinghat.cli.client import SortingHatClient
38
+
37
39
  CONF_FILE = 'test.cfg'
38
40
 
39
41
 
@@ -42,9 +44,17 @@ class TestTasksManager(unittest.TestCase):
42
44
 
43
45
  def setUp(self):
44
46
  self.config = Config(CONF_FILE)
47
+ self.conf = self.config.get_conf()
48
+ sh = self.conf.get('sortinghat')
49
+ self.sortinghat_client = SortingHatClient(host=sh['host'], port=sh.get('port', None),
50
+ path=sh.get('path', None), ssl=sh.get('ssl', False),
51
+ user=sh['user'], password=sh['password'],
52
+ verify_ssl=sh.get('verify_ssl', True),
53
+ tenant=sh.get('tenant', True))
54
+ self.sortinghat_client.connect()
45
55
  mordred = SirMordred(self.config)
46
56
 
47
- task = TaskProjects(self.config)
57
+ task = TaskProjects(self.config, self.sortinghat_client)
48
58
  self.assertEqual(task.execute(), None)
49
59
 
50
60
  self.backends = mordred._get_repos_by_backend()
@@ -217,11 +227,12 @@ class TestTasksManager(unittest.TestCase):
217
227
  self.assertEqual(self.backends[backend], ['bitergia'])
218
228
 
219
229
  def test_initialization(self):
220
- """Test whether attributes are initializated"""
230
+ """Test whether attributes are initialized"""
221
231
 
222
232
  small_delay = 0
223
233
  first_backend = self.backends[list(self.backends.keys())[0]]
224
- manager = TasksManager(self.backend_tasks, first_backend, self.stopper, self.config, timer=small_delay)
234
+ manager = TasksManager(self.backend_tasks, first_backend, self.stopper, self.config,
235
+ self.sortinghat_client, timer=small_delay)
225
236
 
226
237
  self.assertEqual(manager.config, self.config)
227
238
  self.assertEqual(manager.stopper, self.stopper)
@@ -235,12 +246,13 @@ class TestTasksManager(unittest.TestCase):
235
246
 
236
247
  small_delay = 0
237
248
  first_backend = list(self.backends.keys())[0]
238
- manager = TasksManager(self.backend_tasks, first_backend, self.stopper, self.config, timer=small_delay)
249
+ manager = TasksManager(self.backend_tasks, first_backend, self.stopper, self.config,
250
+ self.sortinghat_client, timer=small_delay)
239
251
 
240
252
  self.assertEqual(manager.tasks, [])
241
253
 
242
254
  for tc in manager.tasks_cls:
243
- task = tc(manager.config)
255
+ task = tc(manager.config, manager.client)
244
256
  task.set_backend_section(manager.backend_section)
245
257
  manager.tasks.append(task)
246
258
 
@@ -250,7 +262,8 @@ class TestTasksManager(unittest.TestCase):
250
262
  """Test whether an exception is thrown if a task fails"""
251
263
 
252
264
  small_delay = 0
253
- manager = TasksManager(self.backend_tasks, "fake-section", self.stopper, self.config, timer=small_delay)
265
+ manager = TasksManager(self.backend_tasks, "fake-section", self.stopper,
266
+ self.config, self.sortinghat_client, timer=small_delay)
254
267
 
255
268
  with self.assertRaises(Exception):
256
269
  manager.run()
@@ -1,2 +0,0 @@
1
- # File auto-generated by semverup on 2024-08-13 10:15:47.092016
2
- __version__ = "1.0.5-rc.1"
File without changes
File without changes
File without changes