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
1=== modified file 'charmworld/jobs/ingest.py'
2--- charmworld/jobs/ingest.py 2013-06-25 15:18:42 +0000
3+++ charmworld/jobs/ingest.py 2013-06-27 15:02:27 +0000
4@@ -324,8 +324,8 @@
5 if not charm['promulgated']:
6 return
7
8- charm['tests'] = {}
9- charm['test_results'] = {}
10+ charm.setdefault('tests', {})
11+ charm.setdefault('test_results', {})
12
13 for p in JENKINS_PROVIDERS:
14 try:
15
16=== modified file 'charmworld/jobs/tests/test_jenkins.py'
17--- charmworld/jobs/tests/test_jenkins.py 2013-06-24 15:08:43 +0000
18+++ charmworld/jobs/tests/test_jenkins.py 2013-06-27 15:02:27 +0000
19@@ -68,6 +68,36 @@
20 'promulgated': False,
21 })
22
23+ def test_jenkins_error(self):
24+ # Old test data is retained if store_provider_results() fails,
25+ # for example, if the Jenkins server is unreachable.
26+ expected_test_status = {
27+ 'ec2': 'SUCCESS',
28+ 'openstack': 'SUCCESS',
29+ 'local': 'FAIL',
30+ }
31+ expected_test_results = {
32+ 'ec2': 'whatever',
33+ 'openstack': 'whatever',
34+ 'local': 'whatever',
35+ }
36+ charm = {
37+ 'branch_spec': '~charmers',
38+ 'promulgated': True,
39+ 'tests': expected_test_status.copy(),
40+ 'test_results': expected_test_results.copy(),
41+ }
42+
43+ def failing_store_provider_results(*args):
44+ raise ValueError
45+
46+ with patch.object(ingest, 'store_provider_results',
47+ failing_store_provider_results):
48+ update_jenkins_data(self.db, charm, self.log)
49+
50+ self.assertEqual(expected_test_status, charm['tests'])
51+ self.assertEqual(expected_test_results, charm['test_results'])
52+
53 def test_store_results(self):
54 self.url_result_map = dict([
55 _data_file(

Subscribers

People subscribed via source and target branches