Merge lp:~seyeongkim/charms/trusty/swift-storage/lp1375395 into lp:~openstack-charmers-archive/charms/trusty/swift-storage/next

Proposed by Seyeong Kim
Status: Superseded
Proposed branch: lp:~seyeongkim/charms/trusty/swift-storage/lp1375395
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-storage/next
Diff against target: 140 lines (+73/-7)
3 files modified
unit_tests/test_swift_storage_context.py (+13/-0)
unit_tests/test_swift_storage_relations.py (+45/-7)
unit_tests/test_swift_storage_utils.py (+15/-0)
To merge this branch: bzr merge lp:~seyeongkim/charms/trusty/swift-storage/lp1375395
Reviewer Review Type Date Requested Status
Edward Hope-Morley Needs Fixing
Review via email: mp+247789@code.launchpad.net

This proposal has been superseded by a proposal from 2015-02-25.

To post a comment you must log in.
Revision history for this message
Seyeong Kim (seyeongkim) wrote :

need an advice for this part

because of using - not _ on private-address, got error

#self.relation_set.assert_called_with(
# device='vdb', object_port=6000, account_port=6002,
# zone=1, container_port=6001, private-address='FE80:0000:0000:0000:0202:B3FF:FE1E:8329',
#)
# private-address : keyword can't be an expression

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Seyeong, you could try using a dict i.e.:

args = {'device': 'vdb', 'object_port': 6000, 'account_port': 6002,
        'zone': 1, 'container_port': 6001, 'private-address': 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329'}
self.relation_set.assert_called_with(**args)

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #1464 swift-storage-next for xtrusia mp247789
    UNIT OK: passed

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

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #1509 swift-storage-next for xtrusia mp247789
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  unit_tests/test_swift_storage_utils.py:238:64: E231 missing whitespace after ':'
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/10033239/
Build: http://10.245.162.77:8080/job/charm_lint_check/1509/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #1628 swift-storage-next for xtrusia mp247789
    AMULET OK: passed

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

59. By Seyeong Kim

fix lint error

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #1510 swift-storage-next for xtrusia mp247789
    LINT OK: passed

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

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #1465 swift-storage-next for xtrusia mp247789
    UNIT OK: passed

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

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #1629 swift-storage-next for xtrusia mp247789
    AMULET OK: passed

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

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Seyeong, thanks a lot for adding in new tests it is much appreciated! I have one inline question regarding one of your tests but apart from that this looks good.

Revision history for this message
Seyeong Kim (seyeongkim) :
Revision history for this message
Edward Hope-Morley (hopem) wrote :

See inline.

Revision history for this message
Edward Hope-Morley (hopem) :
review: Needs Fixing
60. By Seyeong Kim

fix with mock

61. By Seyeong Kim

sync rebase

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'unit_tests/test_swift_storage_context.py'
--- unit_tests/test_swift_storage_context.py 2014-10-06 21:45:39 +0000
+++ unit_tests/test_swift_storage_context.py 2015-02-25 09:42:59 +0000
@@ -11,6 +11,7 @@
11 'relation_get',11 'relation_get',
12 'relation_ids',12 'relation_ids',
13 'unit_private_ip',13 'unit_private_ip',
14 'get_ipv6_addr',
14]15]
1516
1617
@@ -46,6 +47,18 @@
46 self.assertEquals({'local_ip': '10.0.0.5'}, ctxt())47 self.assertEquals({'local_ip': '10.0.0.5'}, ctxt())
47 self.assertTrue(ctxt.enable_rsyncd.called)48 self.assertTrue(ctxt.enable_rsyncd.called)
4849
50 def test_rsync_context_ipv6(self):
51 self.test_config.set('prefer-ipv6', True)
52 self.get_ipv6_addr.return_value = [
53 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329', ]
54 ctxt = swift_context.RsyncContext()
55 ctxt.enable_rsyncd = MagicMock()
56 ctxt.enable_rsyncd.return_value = True
57 self.assertEquals({
58 'local_ip': 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329'},
59 ctxt())
60 self.assertTrue(ctxt.enable_rsyncd.called)
61
49 def test_rsync_enable_rsync(self):62 def test_rsync_enable_rsync(self):
50 with patch_open() as (_open, _file):63 with patch_open() as (_open, _file):
51 ctxt = swift_context.RsyncContext()64 ctxt = swift_context.RsyncContext()
5265
=== modified file 'unit_tests/test_swift_storage_relations.py'
--- unit_tests/test_swift_storage_relations.py 2015-01-09 10:21:49 +0000
+++ unit_tests/test_swift_storage_relations.py 2015-02-25 09:42:59 +0000
@@ -39,7 +39,8 @@
39 'setup_rsync',39 'setup_rsync',
40 'setup_storage',40 'setup_storage',
41 'register_configs',41 'register_configs',
42 'update_nrpe_config'42 'update_nrpe_config',
43 'get_ipv6_addr',
43]44]
4445
4546
@@ -82,19 +83,56 @@
82 self.assertTrue(self.do_openstack_upgrade.called)83 self.assertTrue(self.do_openstack_upgrade.called)
83 self.assertTrue(self.CONFIGS.write_all.called)84 self.assertTrue(self.CONFIGS.write_all.called)
8485
86 def test_config_changed_nrpe_master(self):
87 self.openstack_upgrade_available.return_value = False
88 self.relations_of_type.return_value = True
89 with patch_open() as (_open, _file):
90 _file.read.return_value = "foo"
91 hooks.config_changed()
92 self.assertTrue(self.CONFIGS.write_all.called)
93 self.assertTrue(self.setup_rsync.called)
94 self.assertTrue(self.update_nrpe_config.called)
95
96 @patch.object(hooks, 'assert_charm_supports_ipv6')
97 def test_config_changed_ipv6(self, mock_assert_charm_supports_ipv6):
98 self.test_config.set('prefer-ipv6', True)
99 self.openstack_upgrade_available.return_value = False
100 self.relations_of_type.return_value = False
101 with patch_open() as (_open, _file):
102 _file.read.return_value = "foo"
103 hooks.config_changed()
104 self.assertTrue(self.CONFIGS.write_all.called)
105 self.assertTrue(self.setup_rsync.called)
106
85 def test_upgrade_charm(self):107 def test_upgrade_charm(self):
86 self.filter_installed_packages.return_value = ['python-psutil']108 self.filter_installed_packages.return_value = [
109 'python-psutil']
87 hooks.upgrade_charm()110 hooks.upgrade_charm()
88 self.apt_install.assert_called_with(['python-psutil'], fatal=True)111 self.apt_install.assert_called_with([
112 'python-psutil'], fatal=True)
89 self.assertTrue(self.update_nrpe_config.called)113 self.assertTrue(self.update_nrpe_config.called)
90114
91 def test_storage_joined_single_device(self):115 def test_storage_joined_single_device(self):
116 self.determine_block_devices.return_value = [
117 '/dev/vdb']
118 hooks.swift_storage_relation_joined()
119 self.relation_set.assert_called_with(
120 device='vdb', object_port=6000, account_port=6002,
121 zone=1, container_port=6001
122 )
123
124 def test_storage_joined_ipv6(self):
92 self.determine_block_devices.return_value = ['/dev/vdb']125 self.determine_block_devices.return_value = ['/dev/vdb']
126 self.test_config.set('prefer-ipv6', True)
127 self.get_ipv6_addr.return_value = [
128 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329', ]
93 hooks.swift_storage_relation_joined()129 hooks.swift_storage_relation_joined()
94 self.relation_set.assert_called_with(130 args = {
95 device='vdb', object_port=6000, account_port=6002,131 'device': 'vdb', 'object_port': 6000,
96 zone=1, container_port=6001132 'account_port': 6002, 'zone': 1, 'container_port': 6001,
97 )133 'private-address': 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329',
134 }
135 self.relation_set.assert_called_with(**args)
98136
99 def test_storage_joined_multi_device(self):137 def test_storage_joined_multi_device(self):
100 self.determine_block_devices.return_value = ['/dev/vdb', '/dev/vdc',138 self.determine_block_devices.return_value = ['/dev/vdb', '/dev/vdc',
101139
=== modified file 'unit_tests/test_swift_storage_utils.py'
--- unit_tests/test_swift_storage_utils.py 2015-01-09 10:21:49 +0000
+++ unit_tests/test_swift_storage_utils.py 2015-02-25 09:42:59 +0000
@@ -26,6 +26,7 @@
26 'unit_private_ip',26 'unit_private_ip',
27 'service_restart',27 'service_restart',
28 '_save_script_rc',28 '_save_script_rc',
29 'lsb_release',
29]30]
3031
3132
@@ -223,6 +224,20 @@
223 swift_utils.save_script_rc()224 swift_utils.save_script_rc()
224 self._save_script_rc.assert_called_with(**SCRIPT_RC_ENV)225 self._save_script_rc.assert_called_with(**SCRIPT_RC_ENV)
225226
227 def test_assert_charm_not_supports_ipv6(self):
228 self.lsb_release.return_value = {'DISTRIB_ID': 'Ubuntu',
229 'DISTRIB_RELEASE': '12.04',
230 'DISTRIB_CODENAME': 'precise',
231 'DISTRIB_DESCRIPTION': 'Ubuntu 12.04'}
232 self.assertRaises(Exception, swift_utils.assert_charm_supports_ipv6)
233
234 def test_assert_charm_supports_ipv6(self):
235 self.lsb_release.return_value = {'DISTRIB_ID': 'Ubuntu',
236 'DISTRIB_RELEASE': '14.04',
237 'DISTRIB_CODENAME': 'trusty',
238 'DISTRIB_DESCRIPTION': 'Ubuntu 14.04'}
239 swift_utils.assert_charm_supports_ipv6()
240
226 @patch('charmhelpers.contrib.openstack.templating.OSConfigRenderer')241 @patch('charmhelpers.contrib.openstack.templating.OSConfigRenderer')
227 def test_register_configs_pre_install(self, renderer):242 def test_register_configs_pre_install(self, renderer):
228 self.get_os_codename_package.return_value = None243 self.get_os_codename_package.return_value = None

Subscribers

People subscribed via source and target branches