Merge lp:~thedac/charmsupport/volume-management into lp:~ubuntuone-pqm-team/charmsupport/trunk

Proposed by Sidnei da Silva
Status: Merged
Approved by: Sidnei da Silva
Approved revision: 39
Merged at revision: 50
Proposed branch: lp:~thedac/charmsupport/volume-management
Merge into: lp:~ubuntuone-pqm-team/charmsupport/trunk
Diff against target: 57 lines (+8/-6)
3 files modified
charmsupport/hookenv.py (+5/-1)
charmsupport/volumes.py (+1/-1)
tests/test_hookenv.py (+2/-4)
To merge this branch: bzr merge lp:~thedac/charmsupport/volume-management
Reviewer Review Type Date Requested Status
Sidnei da Silva (community) Approve
Review via email: mp+160532@code.launchpad.net

Commit message

Fix dictionary check for volume_map
Allow non-relation context runs

Description of the change

Fix dictionary check for volume_map
Allow non-relation context runs

To post a comment you must log in.
Revision history for this message
Sidnei da Silva (sidnei) :
review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~thedac/charmsupport/volume-management into lp:~ubuntuone-pqm-team/charmsupport/trunk failed. Below is the output from the failed tests.

Starting tests...

...........................F...................................................
======================================================================
FAIL: tests.test_hookenv.HelpersTest.test_relation_ids_no_relation_type
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mock.py", line 1190, in patched
    return func(*args, **keywargs)
  File "/mnt/tarmac/cache/charmsupport/trunk/tests/test_hookenv.py", line 175, in test_relation_ids_no_relation_type
    self.assertEqual(result, ids)
MismatchError: [] != [1, 2, 3]

Name Stmts Miss Cover Missing
----------------------------------------------------
charmsupport 0 0 100%
charmsupport.hookenv 140 11 92% 41, 45, 49-50, 125-130, 180
charmsupport.host 112 2 98% 163, 177
charmsupport.nrpe 83 2 98% 197-198
----------------------------------------------------
TOTAL 335 15 96%
----------------------------------------------------------------------
Ran 79 tests in 0.272s

FAILED (failures=1)
make: *** [test] Error 1

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

There was a problem validating some authors of the branch. Authors must be either one of the listed Launchpad users, or a member of one of the listed teams on Launchpad.

Persons or Teams:

    ubuntuone-hackers

Unaccepted Authors:

    Anthony Lenton <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmsupport/hookenv.py'
2--- charmsupport/hookenv.py 2013-04-03 02:16:23 +0000
3+++ charmsupport/hookenv.py 2013-04-24 17:47:34 +0000
4@@ -136,7 +136,9 @@
5 relid_cmd_line = ['relation-ids', '--format=json']
6 if reltype is not None:
7 relid_cmd_line.append(reltype)
8- return json.loads(subprocess.check_output(relid_cmd_line))
9+ return json.loads(subprocess.check_output(relid_cmd_line))
10+ else:
11+ return []
12
13
14 def related_units(relid=None):
15@@ -174,6 +176,8 @@
16 "Get relations of a specific type"
17 relation_data = []
18 reltype = reltype or relation_type()
19+ if reltype is None:
20+ return []
21 for relid in relation_ids(reltype):
22 for relation in relations_for_id(relid):
23 relation['__relid__'] = relid
24
25=== modified file 'charmsupport/volumes.py'
26--- charmsupport/volumes.py 2013-02-07 21:43:31 +0000
27+++ charmsupport/volumes.py 2013-04-24 17:47:34 +0000
28@@ -74,7 +74,7 @@
29 if volume_map is None:
30 # probably an empty string
31 volume_map = {}
32- elif isinstance(volume_map, dict):
33+ elif not isinstance(volume_map, dict):
34 hookenv.log("Volume-map should be a dictionary, not {}".format(
35 type(volume_map)))
36 errors = True
37
38=== modified file 'tests/test_hookenv.py'
39--- tests/test_hookenv.py 2013-04-03 02:16:23 +0000
40+++ tests/test_hookenv.py 2013-04-24 17:47:34 +0000
41@@ -166,14 +166,12 @@
42 @patch('subprocess.check_output')
43 @patch('charmsupport.hookenv.relation_type')
44 def test_relation_ids_no_relation_type(self, relation_type, check_output):
45- ids = [1, 2, 3]
46- check_output.return_value = json.dumps(ids)
47 relation_type.return_value = None
48
49 result = hookenv.relation_ids()
50
51- self.assertEqual(result, ids)
52- check_output.assert_called_with(['relation-ids', '--format=json'])
53+ self.assertEqual([], result)
54+ check_output.assert_not_called()
55
56 @patch('subprocess.check_output')
57 @patch('charmsupport.hookenv.relation_type')

Subscribers

People subscribed via source and target branches