Merge lp:~james-page/charms/trusty/glance/tox into lp:~openstack-charmers-archive/charms/trusty/glance/next

Proposed by James Page
Status: Merged
Approved by: Billy Olsen
Approved revision: 140
Merged at revision: 139
Proposed branch: lp:~james-page/charms/trusty/glance/tox
Merge into: lp:~openstack-charmers-archive/charms/trusty/glance/next
Diff against target: 255 lines (+90/-23)
10 files modified
.bzrignore (+2/-0)
.testr.conf (+8/-0)
requirements/requirements-precise.txt (+6/-0)
requirements/requirements-trusty.txt (+6/-0)
requirements/test-requirements.txt (+7/-0)
tests/basic_deployment.py (+1/-1)
tox.ini (+35/-0)
unit_tests/test_actions_git_reinstall.py (+3/-0)
unit_tests/test_actions_openstack_upgrade.py (+3/-1)
unit_tests/test_glance_relations.py (+19/-21)
To merge this branch: bzr merge lp:~james-page/charms/trusty/glance/tox
Reviewer Review Type Date Requested Status
Billy Olsen Approve
Review via email: mp+271075@code.launchpad.net
To post a comment you must log in.
140. By James Page

Fixup broken tests due to use of invalid assert_ functions

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

charm_lint_check #10045 glance-next for james-page mp271075
    LINT OK: passed

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

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

charm_unit_test #9211 glance-next for james-page mp271075
    UNIT OK: passed

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

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

charm_lint_check #10046 glance-next for james-page mp271075
    LINT OK: passed

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

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

charm_unit_test #9212 glance-next for james-page mp271075
    UNIT OK: passed

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

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

charm_amulet_test #6431 glance-next for james-page mp271075
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12416310/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6431/

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

charm_amulet_test #6432 glance-next for james-page mp271075
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12416448/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6432/

Revision history for this message
Billy Olsen (billy-olsen) wrote :

\o/ LGTM, nice to be able to run tox. Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2015-04-01 16:48:59 +0000
+++ .bzrignore 2015-09-15 08:05:52 +0000
@@ -1,3 +1,5 @@
1.coverage1.coverage
2bin2bin
3tags3tags
4.tox
5.testrepository
46
=== added file '.testr.conf'
--- .testr.conf 1970-01-01 00:00:00 +0000
+++ .testr.conf 2015-09-15 08:05:52 +0000
@@ -0,0 +1,8 @@
1[DEFAULT]
2test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
3 OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
4 OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
5 ${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION
6
7test_id_option=--load-list $IDFILE
8test_list_option=--list
09
=== added directory 'requirements'
=== added file 'requirements/requirements-precise.txt'
--- requirements/requirements-precise.txt 1970-01-01 00:00:00 +0000
+++ requirements/requirements-precise.txt 2015-09-15 08:05:52 +0000
@@ -0,0 +1,6 @@
1PyYAML==3.10
2simplejson==2.3.2
3netifaces==0.8
4netaddr==0.7.10
5Jinja2==2.6
6six==1.1.0
07
=== added file 'requirements/requirements-trusty.txt'
--- requirements/requirements-trusty.txt 1970-01-01 00:00:00 +0000
+++ requirements/requirements-trusty.txt 2015-09-15 08:05:52 +0000
@@ -0,0 +1,6 @@
1PyYAML>=3.10
2simplejson==3.3.1
3netifaces==0.8
4netaddr==0.7.10
5Jinja2==2.7.2
6six==1.5.2
07
=== added file 'requirements/test-requirements.txt'
--- requirements/test-requirements.txt 1970-01-01 00:00:00 +0000
+++ requirements/test-requirements.txt 2015-09-15 08:05:52 +0000
@@ -0,0 +1,7 @@
1testtools==0.9.35
2coverage==3.7.1
3mock==1.0.1
4flake8==2.1.0
5# No version required
6charm-tools
7os-testr
08
=== modified file 'tests/basic_deployment.py'
--- tests/basic_deployment.py 2015-08-27 12:15:33 +0000
+++ tests/basic_deployment.py 2015-09-15 08:05:52 +0000
@@ -361,7 +361,7 @@
361 expected['keystone_authtoken'].update({361 expected['keystone_authtoken'].update({
362 'auth_host': rel_ks_gl['auth_host'],362 'auth_host': rel_ks_gl['auth_host'],
363 'auth_port': rel_ks_gl['auth_port'],363 'auth_port': rel_ks_gl['auth_port'],
364 'auth_protocol': rel_ks_gl['auth_protocol']364 'auth_protocol': rel_ks_gl['auth_protocol']
365 })365 })
366366
367 return expected367 return expected
368368
=== added file 'tox.ini'
--- tox.ini 1970-01-01 00:00:00 +0000
+++ tox.ini 2015-09-15 08:05:52 +0000
@@ -0,0 +1,35 @@
1[tox]
2# Default to current LTS
3envlist = lint,py27-trusty
4skipsdist = True
5
6[testenv]
7setenv = VIRTUAL_ENV={envdir}
8 PYTHONHASHSEED=0
9install_command =
10 pip install --allow-unverified python-apt {opts} {packages}
11commands = ostestr {posargs}
12
13[testenv:py27-precise]
14basepython = python2.7
15deps = -r{toxinidir}/requirements/requirements-precise.txt
16 -r{toxinidir}/requirements/test-requirements.txt
17
18[testenv:py27-trusty]
19basepython = python2.7
20deps = -r{toxinidir}/requirements/requirements-trusty.txt
21 -r{toxinidir}/requirements/test-requirements.txt
22
23[testenv:lint]
24basepython = python2.7
25deps = -r{toxinidir}/requirements/requirements-trusty.txt
26 -r{toxinidir}/requirements/test-requirements.txt
27commands = flake8 {posargs} actions hooks unit_tests tests
28 charm proof
29
30[testenv:venv]
31commands = {posargs}
32
33[flake8]
34ignore = E402,E226
35exclude = hooks/charmhelpers
036
=== modified file 'unit_tests/test_actions_git_reinstall.py'
--- unit_tests/test_actions_git_reinstall.py 2015-08-27 11:45:25 +0000
+++ unit_tests/test_actions_git_reinstall.py 2015-09-15 08:05:52 +0000
@@ -13,6 +13,7 @@
1313
14TO_PATCH = [14TO_PATCH = [
15 'config',15 'config',
16 'git_install_requested',
16]17]
1718
1819
@@ -31,6 +32,7 @@
31 def setUp(self):32 def setUp(self):
32 super(TestGlanceActions, self).setUp(git_reinstall, TO_PATCH)33 super(TestGlanceActions, self).setUp(git_reinstall, TO_PATCH)
33 self.config.side_effect = self.test_config.get34 self.config.side_effect = self.test_config.get
35 self.git_install_requested.return_value = True
3436
35 @patch.object(git_reinstall, 'action_set')37 @patch.object(git_reinstall, 'action_set')
36 @patch.object(git_reinstall, 'action_fail')38 @patch.object(git_reinstall, 'action_fail')
@@ -56,6 +58,7 @@
56 def test_git_reinstall_not_configured(self, config_changed, git_install,58 def test_git_reinstall_not_configured(self, config_changed, git_install,
57 action_fail, action_set):59 action_fail, action_set):
58 config.return_value = None60 config.return_value = None
61 self.git_install_requested.return_value = False
5962
60 git_reinstall.git_reinstall()63 git_reinstall.git_reinstall()
6164
6265
=== modified file 'unit_tests/test_actions_openstack_upgrade.py'
--- unit_tests/test_actions_openstack_upgrade.py 2015-08-27 09:50:36 +0000
+++ unit_tests/test_actions_openstack_upgrade.py 2015-09-15 08:05:52 +0000
@@ -12,7 +12,8 @@
12)12)
1313
14TO_PATCH = [14TO_PATCH = [
15 'config'15 'config',
16 'git_install_requested',
16]17]
1718
1819
@@ -22,6 +23,7 @@
22 super(TestGlanceUpgradeActions, self).setUp(openstack_upgrade,23 super(TestGlanceUpgradeActions, self).setUp(openstack_upgrade,
23 TO_PATCH)24 TO_PATCH)
24 self.config.side_effect = self.test_config.get25 self.config.side_effect = self.test_config.get
26 self.git_install_requested.return_value = False
2527
26 @patch.object(openstack_upgrade, 'action_set')28 @patch.object(openstack_upgrade, 'action_set')
27 @patch.object(openstack_upgrade, 'action_fail')29 @patch.object(openstack_upgrade, 'action_fail')
2830
=== modified file 'unit_tests/test_glance_relations.py'
--- unit_tests/test_glance_relations.py 2015-09-12 06:27:17 +0000
+++ unit_tests/test_glance_relations.py 2015-09-15 08:05:52 +0000
@@ -143,13 +143,8 @@
143 hostname='glance.foohost.com')143 hostname='glance.foohost.com')
144 self.unit_get.assert_called_with('private-address')144 self.unit_get.assert_called_with('private-address')
145145
146 @patch.object(relations, 'sync_db_with_multi_ipv6_addresses')146 def test_db_joined_with_ipv6(self):
147 @patch.object(relations, 'get_ipv6_addr')
148 def test_db_joined_with_ipv6(self, mock_get_ipv6_addr,
149 mock_sync_db):
150 self.test_config.set('prefer-ipv6', True)147 self.test_config.set('prefer-ipv6', True)
151 mock_get_ipv6_addr.return_value = ['2001:db8:1::1']
152 mock_sync_db.return_value = MagicMock()
153 self.is_relation_made.return_value = False148 self.is_relation_made.return_value = False
154 relations.db_joined()149 relations.db_joined()
155 relation_data = {150 relation_data = {
@@ -158,9 +153,8 @@
158 }153 }
159 relation_data['hostname'] = '2001:db8:1::1'154 relation_data['hostname'] = '2001:db8:1::1'
160155
161 self.sync_db_with_multi_ipv6_addresses.assert_called_with_once(156 self.sync_db_with_multi_ipv6_addresses.assert_called_with(
162 'glance', 'glance')157 'glance', 'glance')
163 self.get_ipv6_addr.assert_called_once()
164158
165 def test_postgresql_db_joined(self):159 def test_postgresql_db_joined(self):
166 self.unit_get.return_value = 'glance.foohost.com'160 self.unit_get.return_value = 'glance.foohost.com'
@@ -724,9 +718,10 @@
724 configs.write = MagicMock()718 configs.write = MagicMock()
725 self.relation_ids.return_value = ['identity-service:0']719 self.relation_ids.return_value = ['identity-service:0']
726 relations.configure_https()720 relations.configure_https()
727 calls = [call('a2dissite', 'openstack_https_frontend'),721 self.check_call.assert_called_with(['a2ensite',
728 call('service', 'apache2', 'reload')]722 'openstack_https_frontend'])
729 self.check_call.assert_called_has_calls(calls)723 self.service_reload.assert_called_with('apache2',
724 restart_on_failure=True)
730 keystone_joined.assert_called_with(relation_id='identity-service:0')725 keystone_joined.assert_called_with(relation_id='identity-service:0')
731726
732 @patch.object(relations, 'canonical_url')727 @patch.object(relations, 'canonical_url')
@@ -739,9 +734,10 @@
739 configs.write = MagicMock()734 configs.write = MagicMock()
740 self.relation_ids.return_value = ['identity-service:0']735 self.relation_ids.return_value = ['identity-service:0']
741 relations.configure_https()736 relations.configure_https()
742 calls = [call('a2dissite', 'openstack_https_frontend'),737 self.check_call.assert_called_with(['a2dissite',
743 call('service', 'apache2', 'reload')]738 'openstack_https_frontend'])
744 self.check_call.assert_called_has_calls(calls)739 self.service_reload.assert_called_with('apache2',
740 restart_on_failure=True)
745 keystone_joined.assert_called_with(relation_id='identity-service:0')741 keystone_joined.assert_called_with(relation_id='identity-service:0')
746742
747 @patch.object(relations, 'canonical_url')743 @patch.object(relations, 'canonical_url')
@@ -754,9 +750,10 @@
754 configs.write = MagicMock()750 configs.write = MagicMock()
755 self.relation_ids.return_value = ['image-service:0']751 self.relation_ids.return_value = ['image-service:0']
756 relations.configure_https()752 relations.configure_https()
757 calls = [call('a2dissite', 'openstack_https_frontend'),753 self.check_call.assert_called_with(['a2ensite',
758 call('service', 'apache2', 'reload')]754 'openstack_https_frontend'])
759 self.check_call.assert_called_has_calls(calls)755 self.service_reload.assert_called_with('apache2',
756 restart_on_failure=True)
760 image_service_joined.assert_called_with(relation_id='image-service:0')757 image_service_joined.assert_called_with(relation_id='image-service:0')
761758
762 @patch.object(relations, 'canonical_url')759 @patch.object(relations, 'canonical_url')
@@ -769,9 +766,10 @@
769 configs.write = MagicMock()766 configs.write = MagicMock()
770 self.relation_ids.return_value = ['image-service:0']767 self.relation_ids.return_value = ['image-service:0']
771 relations.configure_https()768 relations.configure_https()
772 calls = [call('a2dissite', 'openstack_https_frontend'),769 self.check_call.assert_called_with(['a2dissite',
773 call('service', 'apache2', 'reload')]770 'openstack_https_frontend'])
774 self.check_call.assert_called_has_calls(calls)771 self.service_reload.assert_called_with('apache2',
772 restart_on_failure=True)
775 image_service_joined.assert_called_with(relation_id='image-service:0')773 image_service_joined.assert_called_with(relation_id='image-service:0')
776774
777 def test_amqp_joined(self):775 def test_amqp_joined(self):
@@ -785,7 +783,7 @@
785 configs.complete_contexts = MagicMock()783 configs.complete_contexts = MagicMock()
786 configs.complete_contexts.return_value = []784 configs.complete_contexts.return_value = []
787 relations.amqp_changed()785 relations.amqp_changed()
788 self.juju_log.assert_called()786 self.assertTrue(self.juju_log.called)
789787
790 @patch.object(relations, 'CONFIGS')788 @patch.object(relations, 'CONFIGS')
791 def test_amqp_changed_relation_data(self, configs):789 def test_amqp_changed_relation_data(self, configs):

Subscribers

People subscribed via source and target branches