Merge lp:~james-page/charms/trusty/midonet-agent/trunk into lp:~celebdor/charms/trusty/midonet-agent/trunk

Proposed by James Page
Status: Merged
Approved by: Antoni Segura Puimedon
Approved revision: 33
Merged at revision: 33
Proposed branch: lp:~james-page/charms/trusty/midonet-agent/trunk
Merge into: lp:~celebdor/charms/trusty/midonet-agent/trunk
Diff against target: 169 lines (+29/-46)
7 files modified
hooks/install (+12/-8)
tests/006-minimal-trusty-kilo-mem.py (+1/-1)
tests/010-basic-trusty-juno (+1/-1)
tests/011-basic-trusty-kilo (+1/-1)
tests/012-basic-trusty-liberty (+1/-1)
tests/basic_deployment.py (+11/-18)
unit_tests/test_context.py (+2/-16)
To merge this branch: bzr merge lp:~james-page/charms/trusty/midonet-agent/trunk
Reviewer Review Type Date Requested Status
Antoni Segura Puimedon Pending
Review via email: mp+286059@code.launchpad.net

Description of the change

Misc fixes for tests from final review.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/install'
2--- hooks/install 2015-08-11 22:57:10 +0000
3+++ hooks/install 2016-02-15 13:22:03 +0000
4@@ -16,6 +16,7 @@
5 # License for the specific language governing permissions and limitations
6 # under the License.
7 import subprocess
8+import os
9
10 from charmhelpers import fetch # noqa
11 from midonet_helpers import puppet
12@@ -27,12 +28,15 @@
13 puppet.module_install('midonet-midonet')
14 puppet.set_juju_hierarchy(extra_data_dirs=['midonet_agent'])
15
16-# Reload the ovs module
17-try:
18- subprocess.check_call(['rmmod', 'openvswitch'])
19-except subprocess.CalledProcessError:
20- pass # This will fail when openvswitch was not loaded, which is fine
21-subprocess.check_call(['modprobe', 'openvswitch'])
22+# NOTE(jamespage): This works for trusty, but will need a better
23+# check for xenial (systemd provides a helper)
24+if not os.path.exists('/run/container_type'):
25+ # Reload the ovs module
26+ try:
27+ subprocess.check_call(['rmmod', 'openvswitch'])
28+ except subprocess.CalledProcessError:
29+ pass # This will fail when openvswitch was not loaded, which is fine
30+ subprocess.check_call(['modprobe', 'openvswitch'])
31
32-# Make sure gre is loaded
33-subprocess.check_call(['modprobe', 'gre'])
34+ # Make sure gre is loaded
35+ subprocess.check_call(['modprobe', 'gre'])
36
37=== modified file 'tests/006-minimal-trusty-kilo-mem.py'
38--- tests/006-minimal-trusty-kilo-mem.py 2016-02-11 23:08:32 +0000
39+++ tests/006-minimal-trusty-kilo-mem.py 2016-02-15 13:22:03 +0000
40@@ -1,4 +1,4 @@
41-#!/usr/bin/python
42+#!/usr/bin/env python
43 #
44 # Copyright (c) 2015 Midokura SARL, All Rights Reserved.
45 #
46
47=== modified file 'tests/010-basic-trusty-juno'
48--- tests/010-basic-trusty-juno 2016-02-11 23:08:32 +0000
49+++ tests/010-basic-trusty-juno 2016-02-15 13:22:03 +0000
50@@ -1,4 +1,4 @@
51-#!/usr/bin/python
52+#!/usr/bin/env python
53 #
54 # Copyright (c) 2015 Midokura SARL, All Rights Reserved.
55 #
56
57=== modified file 'tests/011-basic-trusty-kilo'
58--- tests/011-basic-trusty-kilo 2016-02-11 23:08:32 +0000
59+++ tests/011-basic-trusty-kilo 2016-02-15 13:22:03 +0000
60@@ -1,4 +1,4 @@
61-#!/usr/bin/python
62+#!/usr/bin/env python
63 #
64 # Copyright (c) 2015 Midokura SARL, All Rights Reserved.
65 #
66
67=== modified file 'tests/012-basic-trusty-liberty'
68--- tests/012-basic-trusty-liberty 2016-02-11 23:08:32 +0000
69+++ tests/012-basic-trusty-liberty 2016-02-15 13:22:03 +0000
70@@ -1,4 +1,4 @@
71-#!/usr/bin/python
72+#!/usr/bin/env python
73 #
74 # Copyright (c) 2015 Midokura SARL, All Rights Reserved.
75 #
76
77=== modified file 'tests/basic_deployment.py'
78--- tests/basic_deployment.py 2016-02-11 23:08:32 +0000
79+++ tests/basic_deployment.py 2016-02-15 13:22:03 +0000
80@@ -36,8 +36,6 @@
81 midonet_origin=None):
82 self.os_release = openstack_origin
83 self.series = ubuntu_series
84- self.midonet_release = (openstack_origin.split('-')[-1] + '/' +
85- midonet_origin)
86 self.midonet_origin = midonet_origin
87 self.mem = self.midonet_origin[:3] == 'mem'
88 self.mem_credentials = {'mem-username': os.getenv('MEM_USERNAME'),
89@@ -65,16 +63,15 @@
90 self._initialize_tests()
91
92 def _add_services(self):
93- self.d.add('mysql', charm='cs:trusty/mysql', units=1,
94+ self.d.add('mysql', charm='mysql', units=1,
95 series=self.series)
96- self.d.add('keystone', charm='keystone', units=1, series=self.series,
97- branch='cs:trusty/keystone')
98- self.d.add('cassandra', charm='cs:trusty/cassandra',
99+ self.d.add('keystone', charm='keystone', units=1,
100+ series=self.series)
101+ self.d.add('cassandra', charm='cassandra',
102 units=1, series=self.series)
103- self.d.add('zookeeper', charm='cs:trusty/zookeeper', units=1,
104+ self.d.add('zookeeper', charm='zookeeper', units=1,
105 series=self.series)
106 self.d.add('compute', charm='nova-compute', units=1,
107- branch='lp:~celebdor/charms/trusty/nova-compute/trunk',
108 series=self.series, constraints={'mem': "4G"})
109 self.d.add('midonet-api', charm='midonet-api', units=1,
110 branch='lp:~celebdor/charms/trusty/midonet-api/trunk',
111@@ -117,16 +114,12 @@
112 'flat-interface': 'eth0',
113 'manage-neutron-plugin-legacy-mode': 'false'})
114
115- api_config = {'midonet-release': self.midonet_release}
116- if self.mem:
117- api_config.update(self.mem_credentials)
118- self.d.configure('midonet-api', api_config)
119-
120- agent_config = {'midonet-origin': self.midonet_origin,
121- 'openstack-origin': self.os_release}
122- if self.mem:
123- agent_config.update(self.mem_credentials)
124- self.d.configure('midonet-agent', agent_config)
125+ midonet_config = {'midonet-origin': self.midonet_origin,
126+ 'openstack-origin': self.os_release}
127+ if self.mem:
128+ midonet_config.update(self.mem_credentials)
129+ self.d.configure('midonet-api', midonet_config)
130+ self.d.configure('midonet-agent', midonet_config)
131
132 def _deploy(self):
133 try:
134
135=== modified file 'unit_tests/test_context.py'
136--- unit_tests/test_context.py 2016-02-11 11:14:48 +0000
137+++ unit_tests/test_context.py 2016-02-15 13:22:03 +0000
138@@ -43,29 +43,15 @@
139 test.CharmTestCase.setUp(self, services.base.hookenv, HOOKENV_PATCHES)
140
141 def lsb_release():
142- ubuntu_trusty = {
143+ return {
144 'DISTRIB_ID': 'Ubuntu',
145 'DISTRIB_RELEASE': '14.04',
146 'DISTRIB_CODENAME': 'trusty',
147 'DISTRIB_DESCRIPTION': "Ubuntu 14.04.3 LTS",
148 }
149
150- try:
151- data = services.host.lsb_release()
152- except Exception:
153- return ubuntu_trusty
154- if data.get('DISTRIB_ID') != 'Ubuntu':
155- return ubuntu_trusty
156- return data
157-
158 def get_os_codename_package(pkg, fatal=True):
159- version = 'liberty'
160- try:
161- ret_vers = services.helpers_utils.get_os_codename_package(
162- pkg, fatal)
163- except Exception:
164- return version
165- return ret_vers
166+ return 'liberty'
167
168 self.patch_all(services.utils,
169 ('get_os_codename_package',

Subscribers

People subscribed via source and target branches