Merge lp:~billy-olsen/charms/trusty/mongodb/fix-unit-tests into lp:charms/trusty/mongodb

Proposed by Billy Olsen on 2015-07-28
Status: Merged
Merged at revision: 75
Proposed branch: lp:~billy-olsen/charms/trusty/mongodb/fix-unit-tests
Merge into: lp:charms/trusty/mongodb
Diff against target: 65 lines (+6/-6)
1 file modified
unit_tests/test_hooks.py (+6/-6)
To merge this branch: bzr merge lp:~billy-olsen/charms/trusty/mongodb/fix-unit-tests
Reviewer Review Type Date Requested Status
Charles Butler (community) 2015-07-28 Approve on 2015-07-28
Review via email: mp+266140@code.launchpad.net
To post a comment you must log in.

charm_lint_check #7096 mongodb for billy-olsen mp266140
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/7096/

charm_unit_test #6594 mongodb for billy-olsen mp266140
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/6594/

Ryan Beisner (1chb1n) wrote :

FYI Unit test full output: http://paste.ubuntu.com/11955246/

charm_unit_test #6595 mongodb for billy-olsen mp266140
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/6595/

charm_lint_check #7097 mongodb for billy-olsen mp266140
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/7097/

charm_amulet_test #5440 mongodb for billy-olsen mp266140
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/5440/

Charles Butler (lazypower) wrote :

Thanks for the contribution Billy, this LGTM. I'll defer to an OS Charmer to pull the trigger on making the merge.

Charles Butler (lazypower) wrote :

Per the comments from beisner on IRC i'm going to merge this. Thanks again for the contribution!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unit_tests/test_hooks.py'
2--- unit_tests/test_hooks.py 2015-01-21 21:50:41 +0000
3+++ unit_tests/test_hooks.py 2015-07-28 18:55:23 +0000
4@@ -89,7 +89,6 @@
5
6 hooks.init_replset()
7
8- mock_run_admin_command.assert_called()
9 self.assertEqual(len(ret_values), mock_run_admin_command.call_count)
10 self.assertEqual(len(ret_values) + 1, mock_sleep.call_count)
11
12@@ -104,7 +103,6 @@
13 except OperationFailure:
14 pass
15
16- mock_run_admin_command.assert_called()
17 self.assertEqual(2, mock_run_admin_command.call_count)
18
19 @patch.object(hooks, 'mongo_client_smart')
20@@ -197,7 +195,7 @@
21 mock_run_admin_cmd.side_effect = OperationFailure('EMPTYCONFIG')
22
23 rv = hooks.am_i_primary()
24- mock_run_admin_cmd.assert_called()
25+ self.assertTrue(mock_run_admin_cmd.called)
26 self.assertFalse(rv)
27
28 mock_run_admin_cmd.reset_mock()
29@@ -206,7 +204,7 @@
30 hooks.am_i_primary()
31 self.assertFalse(True, "Expected OperationFailure to be raised")
32 except OperationFailure:
33- mock_run_admin_cmd.assert_called()
34+ self.assertTrue(mock_run_admin_cmd.called)
35
36 @patch('time.sleep')
37 @patch('subprocess.check_output')
38@@ -295,6 +293,7 @@
39 self.assertEqual(1, mock_join_replset.call_count)
40
41 # Test when not oldest peer, don't init replica set
42+ mock_join_replset.reset_mock()
43 mock_init_replset.reset_mock()
44 mock_oldest_peer.reset_mock()
45 mock_peer_units.return_value = ['mongodb/1', 'mongodb/2']
46@@ -311,11 +310,12 @@
47 mock_oldest_peer.return_value = False
48 mock_is_primary.reset_mock()
49 mock_is_primary.return_value = True
50+ mock_join_replset.reset_mock()
51
52 hooks.replica_set_relation_changed()
53 call1 = call('juju-local-unit-0.local:27017',
54 'juju-remote-unit-0:12345')
55- mock_join_replset.assert_has_calls(call1)
56+ mock_join_replset.assert_has_calls([call1])
57
58 @patch.object(hooks, 'unit_get')
59 @patch.object(hooks, 'leave_replset')
60@@ -338,4 +338,4 @@
61 hooks.replica_set_relation_departed()
62
63 call1 = call('juju-local:27017', 'juju-remote:27017')
64- mock_leave_replset.assert_has_calls(call1)
65+ mock_leave_replset.assert_has_calls([call1])

Subscribers

People subscribed via source and target branches