This is an automated email from the git hooks/post-receive script.
praiskup pushed a commit to branch master
in repository copr/copr.
The following commit(s) were added to refs/heads/master by this push:
new 2fcd6f3 frontend: started on should be also set when a build fails
2fcd6f3 is described below
commit 2fcd6f3fbfbdae5c05f7add8cfa03228961eb941
Author: Silvie Chlupova <sisi.chlupova(a)gmail.com>
AuthorDate: Thu Sep 26 13:25:20 2019 +0200
frontend: started on should be also set when a build fails
Adding unit test for method update_state_from_dict in builds_logic
When a build failed, started_on wasn't set sometimes so this test is
making sure it is always set when a build fails.
Fixes: #342
Merges: #1031
---
frontend/coprs_frontend/coprs/logic/builds_logic.py | 1 +
.../test_views/test_backend_ns/test_backend_general.py | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/frontend/coprs_frontend/coprs/logic/builds_logic.py
b/frontend/coprs_frontend/coprs/logic/builds_logic.py
index 6549057..e88eede 100644
--- a/frontend/coprs_frontend/coprs/logic/builds_logic.py
+++ b/frontend/coprs_frontend/coprs/logic/builds_logic.py
@@ -935,6 +935,7 @@ ORDER BY
for ch in build.build_chroots:
ch.status = new_status
ch.ended_on = upd_dict.get("ended_on") or time.time()
+ ch.started_on = upd_dict.get("started_on", ch.ended_on)
db.session.add(ch)
if new_status == StatusEnum("failed"):
diff --git
a/frontend/coprs_frontend/tests/test_views/test_backend_ns/test_backend_general.py
b/frontend/coprs_frontend/tests/test_views/test_backend_ns/test_backend_general.py
index 976d01e..4a3a5bf 100644
--- a/frontend/coprs_frontend/tests/test_views/test_backend_ns/test_backend_general.py
+++ b/frontend/coprs_frontend/tests/test_views/test_backend_ns/test_backend_general.py
@@ -166,6 +166,19 @@ class TestUpdateBuilds(CoprsTestCase):
assert updated.status == 1
assert updated.chroots_ended_on == {'fedora-18-x86_64': 1490866440}
+ def test_update_state_from_dict(self, f_users, f_fork_prepare):
+ upd_dict = {'build_id': 6, 'chroot': 'srpm-builds',
+ 'destdir': '/var/lib/copr/public_html/results',
'enable_net': False, 'ended_on': 1569919634,
+ 'id': 6, 'source_type': 0, 'status': 0,
'submitter': 'user1', 'task_id': '6', 'timeout':
3600}
+ BuildsLogic.update_state_from_dict(self.b6, upd_dict)
+ updated = self.models.Build.query.filter(self.models.Build.id == 6).one()
+ assert upd_dict['ended_on'] == updated.started_on
+
+ upd_dict['started_on'] = 1569919624
+ BuildsLogic.update_state_from_dict(self.b6, upd_dict)
+ updated = self.models.Build.query.filter(self.models.Build.id == 6).one()
+ assert upd_dict['started_on'] == updated.started_on
+
def test_update_more_existent_and_non_existent_builds(
self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date