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

Proposed by James Page
Status: Merged
Merged at revision: 131
Proposed branch: lp:~james-page/charms/trusty/rabbitmq-server/tox-switchover
Merge into: lp:~openstack-charmers-archive/charms/trusty/rabbitmq-server/next
Diff against target: 252 lines (+77/-53)
8 files modified
.bzrignore (+2/-0)
.testr.conf (+8/-0)
Makefile (+6/-17)
requirements.txt (+12/-0)
test-requirements.txt (+8/-5)
tox.ini (+29/-0)
unit_tests/__init__.py (+3/-0)
unit_tests/test_rabbitmq_server_relations.py (+9/-31)
To merge this branch: bzr merge lp:~james-page/charms/trusty/rabbitmq-server/tox-switchover
Reviewer Review Type Date Requested Status
Ryan Beisner (community) Approve
Liam Young Approve
Review via email: mp+286139@code.launchpad.net
To post a comment you must log in.
133. By James Page

Further makefile tidy

Revision history for this message
Liam Young (gnuoy) wrote :

LGTM but I'd like to make sure that the osci initiated tests work

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

charm_unit_test #566 rabbitmq-server-next for james-page mp286139
    UNIT FAIL: unit-test missing

UNIT Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full unit test output: http://paste.ubuntu.com/15089617/
Build: http://10.245.162.36:8080/job/charm_unit_test/566/

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

charm_lint_check #655 rabbitmq-server-next for james-page mp286139
    LINT FAIL: lint-test missing

LINT Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full lint test output: http://paste.ubuntu.com/15089618/
Build: http://10.245.162.36:8080/job/charm_lint_check/655/

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

charm_amulet_test #262 rabbitmq-server-next for james-page mp286139
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
2016-02-16 11:36:04,819 publish_amqp_message_by_unit DEBUG: Publishing message...
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/15090573/
Build: http://10.245.162.36:8080/job/charm_amulet_test/262/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

FYI, adjusting automation to be tox aware, will re-trigger unit and lint.

RE: amulet, one of the rmq units never reached "ready" state, will also retrigger.

rabbitmq-server/2 maintenance executing 1.25.3 6 5671/tcp,5672/tcp 172.17.104.67 (config-changed) Random wait for restart to avoid collisions

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

charm_unit_test #567 rabbitmq-server-next for james-page mp286139
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/567/

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

charm_lint_check #657 rabbitmq-server-next for james-page mp286139
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/657/

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

charm_amulet_test #263 rabbitmq-server-next for james-page mp286139
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
2016-02-16 15:11:51,342 connect_amqp_by_unit DEBUG: Connecting to amqp on 172.17.105.185:5672 (rabbitmq-server/0) as testuser1...
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/15092486/
Build: http://10.245.162.36:8080/job/charm_amulet_test/263/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

I think your test is hitting this. It's definitely unrelated to the proposed changes.

https://bugs.launchpad.net/charms/+source/rabbitmq-server/+bug/1546255

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2015-01-23 08:23:05 +0000
3+++ .bzrignore 2016-02-16 07:58:06 +0000
4@@ -2,3 +2,5 @@
5 revision
6 .coverage
7 .venv
8+.tox
9+.testrepository
10
11=== added file '.testr.conf'
12--- .testr.conf 1970-01-01 00:00:00 +0000
13+++ .testr.conf 2016-02-16 07:58:06 +0000
14@@ -0,0 +1,8 @@
15+[DEFAULT]
16+test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
17+ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
18+ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
19+ ${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION
20+
21+test_id_option=--load-list $IDFILE
22+test_list_option=--list
23
24=== modified file 'Makefile'
25--- Makefile 2015-10-21 13:36:00 +0000
26+++ Makefile 2016-02-16 07:58:06 +0000
27@@ -5,20 +5,11 @@
28 TEST_PREFIX := PYTHONPATH=$(HOOKS_DIR)
29
30 clean:
31- rm -f .coverage
32+ rm -f .coverage .testrepository
33 find . -name '*.pyc' -delete
34- rm -rf .venv
35- (which dh_clean && dh_clean) || true
36-
37-.venv:
38- sudo apt-get install -y gcc python-dev python-virtualenv python-apt
39- virtualenv .venv --system-site-packages
40- .venv/bin/pip install -I -r test-requirements.txt
41-
42-lint: .venv
43- @.venv/bin/flake8 --exclude hooks/charmhelpers,tests/charmhelpers hooks \
44- unit_tests tests
45- @charm proof
46+
47+lint:
48+ tox -e pep8
49
50 bin/charm_helpers_sync.py:
51 @mkdir -p bin
52@@ -33,10 +24,8 @@
53 bzr push lp:charms/rabbitmq-server
54 bzr push lp:charms/trusty/rabbitmq-server
55
56-test: .venv
57- @echo Starting tests...
58- env CHARM_DIR=$(CHARM_DIR) $(TEST_PREFIX) .venv/bin/nosetests \
59- -v --nologcapture --with-coverage unit_tests/
60+test:
61+ tox -e py27
62
63 functional_test:
64 @echo Starting amulet tests...
65
66=== added file 'requirements.txt'
67--- requirements.txt 1970-01-01 00:00:00 +0000
68+++ requirements.txt 2016-02-16 07:58:06 +0000
69@@ -0,0 +1,12 @@
70+# The order of packages is significant, because pip processes them in the order
71+# of appearance. Changing the order has an impact on the overall integration
72+# process, which may cause wedges in the gate later.
73+PyYAML>=3.1.0
74+simplejson>=2.2.0
75+netifaces>=0.10.4
76+netaddr>=0.7.12,!=0.7.16
77+Jinja2>=2.6 # BSD License (3 clause)
78+six>=1.9.0
79+dnspython>=1.12.0
80+psutil>=1.1.1,<2.0.0
81+python-neutronclient>=2.6.0
82
83=== modified file 'test-requirements.txt'
84--- test-requirements.txt 2015-01-23 09:01:50 +0000
85+++ test-requirements.txt 2016-02-16 07:58:06 +0000
86@@ -1,5 +1,8 @@
87-nose
88-testtools
89-mock
90-coverage
91-flake8
92+# The order of packages is significant, because pip processes them in the order
93+# of appearance. Changing the order has an impact on the overall integration
94+# process, which may cause wedges in the gate later.
95+coverage>=3.6
96+mock>=1.2
97+flake8>=2.2.4,<=2.4.1
98+os-testr>=0.4.1
99+charm-tools
100
101=== added file 'tox.ini'
102--- tox.ini 1970-01-01 00:00:00 +0000
103+++ tox.ini 2016-02-16 07:58:06 +0000
104@@ -0,0 +1,29 @@
105+[tox]
106+envlist = pep8,py27
107+skipsdist = True
108+
109+[testenv]
110+setenv = VIRTUAL_ENV={envdir}
111+ PYTHONHASHSEED=0
112+install_command =
113+ pip install --allow-unverified python-apt {opts} {packages}
114+commands = ostestr {posargs}
115+
116+[testenv:py27]
117+basepython = python2.7
118+deps = -r{toxinidir}/requirements.txt
119+ -r{toxinidir}/test-requirements.txt
120+
121+[testenv:pep8]
122+basepython = python2.7
123+deps = -r{toxinidir}/requirements.txt
124+ -r{toxinidir}/test-requirements.txt
125+commands = flake8 {posargs} hooks unit_tests tests
126+ charm proof
127+
128+[testenv:venv]
129+commands = {posargs}
130+
131+[flake8]
132+ignore = E402,E226
133+exclude = hooks/charmhelpers
134
135=== modified file 'unit_tests/__init__.py'
136--- unit_tests/__init__.py 2014-10-08 15:57:57 +0000
137+++ unit_tests/__init__.py 2016-02-16 07:58:06 +0000
138@@ -0,0 +1,3 @@
139+import sys
140+
141+sys.path.append('hooks/')
142
143=== modified file 'unit_tests/test_rabbitmq_server_relations.py'
144--- unit_tests/test_rabbitmq_server_relations.py 2015-10-19 03:33:39 +0000
145+++ unit_tests/test_rabbitmq_server_relations.py 2016-02-16 07:58:06 +0000
146@@ -1,6 +1,6 @@
147 import os
148 from testtools import TestCase
149-from mock import patch, MagicMock
150+from mock import patch
151
152 os.environ['JUJU_UNIT_NAME'] = 'UNIT_TEST/0' # noqa - needed for import
153 import rabbitmq_server_relations
154@@ -11,31 +11,11 @@
155 self.fake_repo = {}
156 super(RelationUtil, self).setUp()
157
158- def _apt_cache(self):
159- """Used for mocking out apt_pkg.Cache"""
160- # mocks out the apt cache
161- def cache_get(package):
162- pkg = MagicMock()
163- if package in self.fake_repo \
164- and 'pkg_vers' in self.fake_repo[package]:
165- pkg.name = package
166- pkg.current_ver.ver_str = self.fake_repo[package]['pkg_vers']
167- elif (package in self.fake_repo and
168- 'pkg_vers' not in self.fake_repo[package]):
169- pkg.name = package
170- pkg.current_ver = None
171- else:
172- raise KeyError
173- return pkg
174- cache = MagicMock()
175- cache.__getitem__.side_effect = cache_get
176- return cache
177-
178 @patch('rabbitmq_server_relations.peer_store_and_set')
179 @patch('rabbitmq_server_relations.get_ipv6_addr')
180 @patch('rabbitmq_server_relations.config')
181 @patch('rabbitmq_server_relations.relation_set')
182- @patch('apt_pkg.Cache')
183+ @patch('rabbitmq_server_relations.cmp_pkgrevno')
184 @patch('rabbitmq_server_relations.is_clustered')
185 @patch('rabbitmq_server_relations.ssl_utils.configure_client_ssl')
186 @patch('rabbitmq_server_relations.unit_get')
187@@ -44,7 +24,7 @@
188 def test_amqp_changed_compare_versions_ha_queues(
189 self,
190 is_elected_leader, relation_get, unit_get, configure_client_ssl,
191- is_clustered, apt_cache, relation_set, mock_config,
192+ is_clustered, cmp_pkgrevno, relation_set, mock_config,
193 mock_get_ipv6_addr, mock_peer_store_and_set):
194 """
195 Compare version above and below 3.0.1.
196@@ -64,9 +44,8 @@
197 is_elected_leader.return_value = True
198 relation_get.return_value = {}
199 is_clustered.return_value = False
200- apt_cache.return_value = self._apt_cache()
201+ cmp_pkgrevno.return_value = -1
202
203- self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0'}}
204 rabbitmq_server_relations.amqp_changed(None, None)
205 mock_peer_store_and_set.assert_called_with(
206 relation_settings={'private-address': '10.1.2.3',
207@@ -74,7 +53,7 @@
208 'ha_queues': True},
209 relation_id=None)
210
211- self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0.2'}}
212+ cmp_pkgrevno.return_value = 1
213 rabbitmq_server_relations.amqp_changed(None, None)
214 mock_peer_store_and_set.assert_called_with(
215 relation_settings={'private-address': '10.1.2.3',
216@@ -85,7 +64,7 @@
217 @patch('rabbitmq_server_relations.get_ipv6_addr')
218 @patch('rabbitmq_server_relations.config')
219 @patch('rabbitmq_server_relations.relation_set')
220- @patch('apt_pkg.Cache')
221+ @patch('rabbitmq_server_relations.cmp_pkgrevno')
222 @patch('rabbitmq_server_relations.is_clustered')
223 @patch('rabbitmq_server_relations.ssl_utils.configure_client_ssl')
224 @patch('rabbitmq_server_relations.unit_get')
225@@ -94,7 +73,7 @@
226 def test_amqp_changed_compare_versions_ha_queues_prefer_ipv6(
227 self,
228 is_elected_leader, relation_get, unit_get, configure_client_ssl,
229- is_clustered, apt_cache, relation_set, mock_config,
230+ is_clustered, cmp_pkgrevno, relation_set, mock_config,
231 mock_get_ipv6_addr, mock_peer_store_and_set):
232 """
233 Compare version above and below 3.0.1.
234@@ -115,16 +94,15 @@
235 is_elected_leader.return_value = True
236 relation_get.return_value = {}
237 is_clustered.return_value = False
238- apt_cache.return_value = self._apt_cache()
239+ cmp_pkgrevno.return_value = -1
240
241- self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0'}}
242 rabbitmq_server_relations.amqp_changed(None, None)
243 mock_peer_store_and_set.assert_called_with(
244 relation_settings={'private-address': ipv6_addr,
245 'ha_queues': True},
246 relation_id=None)
247
248- self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0.2'}}
249+ cmp_pkgrevno.return_value = 1
250 rabbitmq_server_relations.amqp_changed(None, None)
251 mock_peer_store_and_set.assert_called_with(
252 relation_settings={'private-address': ipv6_addr},

Subscribers

People subscribed via source and target branches