| |
@@ -3,16 +3,6 @@
|
| |
from oraculum.utils import koschei
|
| |
from oraculum import app, CACHE
|
| |
|
| |
- class MockedKoji():
|
| |
-
|
| |
- def multiCall():
|
| |
- # Koji returns only one build per release
|
| |
- stub_koji_element_a = [[{'tag_id': 2, 'tag_name': 'f98', 'id': 1, 'build_id': 1, 'version': '1.2.2', 'release': '2.fc98', 'epoch': None, 'state': 1, 'completion_time': '2020-01-28 11:08:00.940846+00:00', 'start_time': '2020-01-28 11:06:16.563830+00:00', 'task_id': 1, 'creation_event_id': 1, 'creation_time': '2020-01-28 11:06:16.563830+00:00', 'volume_id': 0, 'volume_name': 'DEFAULT', 'package_id': 1, 'package_name': 'package_a', 'name': 'package_a', 'nvr': 'package_a-1.2.2-2.fc99', 'owner_id': 1, 'owner_name': 'releng'}]]
|
| |
-
|
| |
- stub_koji_element_b = [[{'tag_id': 3, 'tag_name': 'f99', 'id': 2, 'build_id': 2, 'version': '1.2.2', 'release': '1.fc99', 'epoch': None, 'state': 1, 'completion_time': '2020-01-01 11:08:00.940846+00:00', 'start_time': '2020-01-01 11:06:16.563830+00:00', 'task_id': 1, 'creation_event_id': 1, 'creation_time': '2020-01-01 11:06:16.563830+00:00', 'volume_id': 0, 'volume_name': 'DEFAULT', 'package_id': 1, 'package_name': 'package_a', 'name': 'package_a', 'nvr': 'package_a-1.2.2-1.fc99', 'owner_id': 1, 'owner_name': 'releng'}]]
|
| |
-
|
| |
- return [stub_koji_element_a, stub_koji_element_b]
|
| |
-
|
| |
|
| |
class TestKoschei(object):
|
| |
|
| |
@@ -34,7 +24,7 @@
|
| |
'url': 'https://koschei.fedoraproject.org/package/package_a?collection=f98'
|
| |
},
|
| |
{
|
| |
- 'last_success': {'time': None, 'url': None},
|
| |
+ 'last_success': {'time': "2020-01-01T11:08:00.940846", 'url': "https://koji.fedoraproject.org/koji/taskinfo?taskID=2"},
|
| |
'release': 'Fedora Rawhide',
|
| |
'status': 'failing',
|
| |
'url': 'https://koschei.fedoraproject.org/package/package_a?collection=f99'
|
| |
@@ -61,10 +51,7 @@
|
| |
"name":"package_a",
|
| |
"collection":"f98",
|
| |
"state":"ok",
|
| |
- "last_complete_build":
|
| |
- {
|
| |
- "task_id":1
|
| |
- }
|
| |
+ "last_complete_build": None
|
| |
},
|
| |
{
|
| |
"name":"package_a",
|
| |
@@ -72,35 +59,27 @@
|
| |
"state":"failing",
|
| |
"last_complete_build":
|
| |
{
|
| |
- "task_id":2
|
| |
+ "task_id": 2,
|
| |
+ "time_finished": "2020-01-01T11:08:00.940846"
|
| |
}
|
| |
},
|
| |
{
|
| |
"name":"package_a",
|
| |
"collection":"epel1",
|
| |
"state":"ok",
|
| |
- "last_complete_build":
|
| |
- {
|
| |
- "task_id":3
|
| |
- }
|
| |
+ "last_complete_build": None
|
| |
},
|
| |
{
|
| |
"name":"package_a",
|
| |
"collection":"epel2",
|
| |
"state":"blocked",
|
| |
- "last_complete_build":
|
| |
- {
|
| |
- "task_id":4
|
| |
- }
|
| |
+ "last_complete_build": None
|
| |
},
|
| |
{
|
| |
"name":"package_a",
|
| |
"collection":"eln",
|
| |
"state":"blocked",
|
| |
- "last_complete_build":
|
| |
- {
|
| |
- "task_id":5
|
| |
- }
|
| |
+ "last_complete_build": None
|
| |
}
|
| |
]
|
| |
|
| |
@@ -111,20 +90,4 @@
|
| |
|
| |
monkeypatch.setattr(CACHE, 'get', mock.MagicMock(return_value=self.stub_fedora_releases))
|
| |
monkeypatch.setattr(koschei, 'get_json', mock.MagicMock(return_value=stub_koschei_data))
|
| |
- monkeypatch.setattr(koschei, 'koji', mock.MagicMock(return_value=True))
|
| |
assert koschei.parse_koschei_data() == self.koschei_result
|
| |
-
|
| |
- def test_koji_data(self, monkeypatch):
|
| |
-
|
| |
- expected_result = {
|
| |
- 'last_success': {'time': '2020-01-01 11:08:00.940846+00:00', 'url': 'https://koji.fedoraproject.org/koji/buildinfo?buildID=2'},
|
| |
- 'release': 'Fedora Rawhide',
|
| |
- 'status': 'failing',
|
| |
- 'url': 'https://koschei.fedoraproject.org/package/package_a?collection=f99'
|
| |
- }
|
| |
-
|
| |
- monkeypatch.setattr(CACHE, 'get', mock.MagicMock(return_value=self.stub_fedora_releases))
|
| |
- result = koschei.process_koji_queue(MockedKoji, self.koschei_result)
|
| |
-
|
| |
- assert len(result) == 1
|
| |
- assert expected_result in result['package_a']
|
| |
Fixes https://pagure.io/fedora-qa/packager_dashboard/issue/55