Merge lp:~adeuring/charmworld/1192544-dont-hide-charms-with-processing-errors into lp:~juju-jitsu/charmworld/trunk

Proposed by Abel Deuring
Status: Merged
Approved by: Abel Deuring
Approved revision: 289
Merged at revision: 288
Proposed branch: lp:~adeuring/charmworld/1192544-dont-hide-charms-with-processing-errors
Merge into: lp:~juju-jitsu/charmworld/trunk
Diff against target: 83 lines (+6/-18)
4 files modified
charmworld/models.py (+0/-1)
charmworld/search.py (+0/-3)
charmworld/tests/test_models.py (+3/-3)
charmworld/tests/test_search.py (+3/-11)
To merge this branch: bzr merge lp:~adeuring/charmworld/1192544-dont-hide-charms-with-processing-errors
Reviewer Review Type Date Requested Status
Abel Deuring (community) Approve
Aaron Bentley (community) Approve
Review via email: mp+171756@code.launchpad.net

Commit message

Do not filter charm with processing errors in search() and find_charms().

Description of the change

This branch removes the filters "don't include charms where charm.error is set" from the functions search() and find_charms(). This should fix bugs 1194554, 1192556, 1192544.

One corner case remains: If an ingest error occurs for a charm that is not yet stored in the MongoDB, it can happen that we now show a charm without having any intersting information about it, like the provided/required interfaces, the description or summary.

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

Please change the tests so that instead of testing store errors, they test that processing errors do *not* cause the charms to be hidden. Otherwise, looks fine.

review: Approve
Revision history for this message
Abel Deuring (adeuring) :
review: Approve
Revision history for this message
Charmworld Lander (charmworld-lander) wrote :
Revision history for this message
Abel Deuring (adeuring) :
review: Approve
Revision history for this message
Charmworld Lander (charmworld-lander) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Abel Deuring (adeuring) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmworld/models.py'
2--- charmworld/models.py 2013-06-26 15:29:55 +0000
3+++ charmworld/models.py 2013-06-27 15:43:27 +0000
4@@ -1041,7 +1041,6 @@
5 if spec is None:
6 spec = {}
7 spec['store_data.errors'] = {'$exists': False}
8- spec['error'] = {'$exists': False}
9 if only_promulgated:
10 if spec is None:
11 spec = {}
12
13=== modified file 'charmworld/search.py'
14--- charmworld/search.py 2013-06-25 13:14:10 +0000
15+++ charmworld/search.py 2013-06-27 15:43:27 +0000
16@@ -94,9 +94,6 @@
17
18 valid_charms_clauses = [
19 {'missing': {'field': 'store_data.errors'}},
20- # 'missing' ignores objects/dicts, but 'not': {'exists'}
21- # considers them.
22- {'not': {'exists': {'field': 'error'}}}
23 ]
24
25 def __init__(self, client, index_name):
26
27=== modified file 'charmworld/tests/test_models.py'
28--- charmworld/tests/test_models.py 2013-06-26 15:29:55 +0000
29+++ charmworld/tests/test_models.py 2013-06-27 15:43:27 +0000
30@@ -986,12 +986,12 @@
31 }
32 self.assertEqual(expected, result[0])
33
34- def test_hide_with_error(self):
35+ def test_dont_hide_with_processing_error(self):
36+ # Charms with errors that occured during the ingest script
37+ # are returned by find_charms()
38 charm_id, charm_data = factory.makeCharm(self.db)
39- self.assertIn(charm_data, find_charms(self.db))
40 charm_data['error'] = {}
41 self.db.charms.save(charm_data)
42- self.assertNotIn(charm_data, find_charms(self.db))
43 self.assertIn(charm_data,
44 find_charms(self.db, valid_charms_only=False))
45
46
47=== modified file 'charmworld/tests/test_search.py'
48--- charmworld/tests/test_search.py 2013-06-25 13:14:10 +0000
49+++ charmworld/tests/test_search.py 2013-06-27 15:43:27 +0000
50@@ -414,30 +414,22 @@
51 self.assertEqual(set(('good-charm', 'evil-charm')), names)
52
53 def test_search_charm_with_error(self):
54- """searches do not return charms with errors by default."""
55+ """searches include charms with processing errors."""
56 charm = Charm(self.makeCharm())
57 result = self.index_client.search(charm.name)
58 self.assertEqual(charm, result['results'][0]['data'])
59 charm._representation['error'] = {'error': 'error text'}
60 self.index_client.index_charm(charm._representation)
61 result = self.index_client.search(charm.name)
62- self.assertEqual([], result['results'])
63- result = self.index_client.search(
64- charm.name, valid_charms_only=False)
65 self.assertEqual(charm, result['results'][0]['data'])
66
67 def test_api_search_charm_with_error(self):
68- """searches do not return charms with errors by default."""
69+ """Search results include charms with processing errors."""
70 charm = self.makeCharm()
71- result = self.index_client.api_search(charm['name'])
72- self.assertEqual(charm, result[0])
73 charm['error'] = {'error': 'error text'}
74 self.index_client.index_charm(charm)
75 result = self.index_client.api_search(charm['name'])
76- self.assertEqual([], result)
77- result = self.index_client.api_search(
78- charm['name'], valid_charms_only=False)
79- self.assertEqual(charm, result[0])
80+ self.assertEqual([charm], result)
81
82 def test_search_charm_sort_most_downloaded(self):
83 """Specifying 'downloaded' sorts results appropriately."""

Subscribers

People subscribed via source and target branches