Merge lp:~adeuring/charmworld/1192559-forgotten-jenkins-results into lp:~juju-jitsu/charmworld/trunk

Proposed by Abel Deuring
Status: Merged
Approved by: Abel Deuring
Approved revision: 289
Merged at revision: 287
Proposed branch: lp:~adeuring/charmworld/1192559-forgotten-jenkins-results
Merge into: lp:~juju-jitsu/charmworld/trunk
Diff against target: 55 lines (+32/-2)
2 files modified
charmworld/jobs/ingest.py (+2/-2)
charmworld/jobs/tests/test_jenkins.py (+30/-0)
To merge this branch: bzr merge lp:~adeuring/charmworld/1192559-forgotten-jenkins-results
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+171825@code.launchpad.net

Commit message

do not drop old charm test results when the Jenkins server can't be reached.

Description of the change

This branch has a trivial fix of an error of the ingest worker:

charm['tests'] and charm['test_results] are set to an empty dictionary in update_jenkins_data(); when store_provider_results() (called by update_jenkins_data()) raises an exception, no test data is added for the current provider. This may result in completely missing test data. The fix is obvious, I think.

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) :
review: Approve
Revision history for this message
Charmworld Lander (charmworld-lander) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charmworld/jobs/ingest.py'
--- charmworld/jobs/ingest.py 2013-06-25 15:18:42 +0000
+++ charmworld/jobs/ingest.py 2013-06-27 15:02:27 +0000
@@ -324,8 +324,8 @@
324 if not charm['promulgated']:324 if not charm['promulgated']:
325 return325 return
326326
327 charm['tests'] = {}327 charm.setdefault('tests', {})
328 charm['test_results'] = {}328 charm.setdefault('test_results', {})
329329
330 for p in JENKINS_PROVIDERS:330 for p in JENKINS_PROVIDERS:
331 try:331 try:
332332
=== modified file 'charmworld/jobs/tests/test_jenkins.py'
--- charmworld/jobs/tests/test_jenkins.py 2013-06-24 15:08:43 +0000
+++ charmworld/jobs/tests/test_jenkins.py 2013-06-27 15:02:27 +0000
@@ -68,6 +68,36 @@
68 'promulgated': False,68 'promulgated': False,
69 })69 })
7070
71 def test_jenkins_error(self):
72 # Old test data is retained if store_provider_results() fails,
73 # for example, if the Jenkins server is unreachable.
74 expected_test_status = {
75 'ec2': 'SUCCESS',
76 'openstack': 'SUCCESS',
77 'local': 'FAIL',
78 }
79 expected_test_results = {
80 'ec2': 'whatever',
81 'openstack': 'whatever',
82 'local': 'whatever',
83 }
84 charm = {
85 'branch_spec': '~charmers',
86 'promulgated': True,
87 'tests': expected_test_status.copy(),
88 'test_results': expected_test_results.copy(),
89 }
90
91 def failing_store_provider_results(*args):
92 raise ValueError
93
94 with patch.object(ingest, 'store_provider_results',
95 failing_store_provider_results):
96 update_jenkins_data(self.db, charm, self.log)
97
98 self.assertEqual(expected_test_status, charm['tests'])
99 self.assertEqual(expected_test_results, charm['test_results'])
100
71 def test_store_results(self):101 def test_store_results(self):
72 self.url_result_map = dict([102 self.url_result_map = dict([
73 _data_file(103 _data_file(

Subscribers

People subscribed via source and target branches