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
=== modified file 'hooks/install'
--- hooks/install 2015-08-11 22:57:10 +0000
+++ hooks/install 2016-02-15 13:22:03 +0000
@@ -16,6 +16,7 @@
16# License for the specific language governing permissions and limitations16# License for the specific language governing permissions and limitations
17# under the License.17# under the License.
18import subprocess18import subprocess
19import os
1920
20from charmhelpers import fetch # noqa21from charmhelpers import fetch # noqa
21from midonet_helpers import puppet22from midonet_helpers import puppet
@@ -27,12 +28,15 @@
27puppet.module_install('midonet-midonet')28puppet.module_install('midonet-midonet')
28puppet.set_juju_hierarchy(extra_data_dirs=['midonet_agent'])29puppet.set_juju_hierarchy(extra_data_dirs=['midonet_agent'])
2930
30# Reload the ovs module31# NOTE(jamespage): This works for trusty, but will need a better
31try:32# check for xenial (systemd provides a helper)
32 subprocess.check_call(['rmmod', 'openvswitch'])33if not os.path.exists('/run/container_type'):
33except subprocess.CalledProcessError:34 # Reload the ovs module
34 pass # This will fail when openvswitch was not loaded, which is fine35 try:
35subprocess.check_call(['modprobe', 'openvswitch'])36 subprocess.check_call(['rmmod', 'openvswitch'])
37 except subprocess.CalledProcessError:
38 pass # This will fail when openvswitch was not loaded, which is fine
39 subprocess.check_call(['modprobe', 'openvswitch'])
3640
37# Make sure gre is loaded41 # Make sure gre is loaded
38subprocess.check_call(['modprobe', 'gre'])42 subprocess.check_call(['modprobe', 'gre'])
3943
=== modified file 'tests/006-minimal-trusty-kilo-mem.py'
--- tests/006-minimal-trusty-kilo-mem.py 2016-02-11 23:08:32 +0000
+++ tests/006-minimal-trusty-kilo-mem.py 2016-02-15 13:22:03 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/python1#!/usr/bin/env python
2#2#
3# Copyright (c) 2015 Midokura SARL, All Rights Reserved.3# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
4#4#
55
=== modified file 'tests/010-basic-trusty-juno'
--- tests/010-basic-trusty-juno 2016-02-11 23:08:32 +0000
+++ tests/010-basic-trusty-juno 2016-02-15 13:22:03 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/python1#!/usr/bin/env python
2#2#
3# Copyright (c) 2015 Midokura SARL, All Rights Reserved.3# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
4#4#
55
=== modified file 'tests/011-basic-trusty-kilo'
--- tests/011-basic-trusty-kilo 2016-02-11 23:08:32 +0000
+++ tests/011-basic-trusty-kilo 2016-02-15 13:22:03 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/python1#!/usr/bin/env python
2#2#
3# Copyright (c) 2015 Midokura SARL, All Rights Reserved.3# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
4#4#
55
=== modified file 'tests/012-basic-trusty-liberty'
--- tests/012-basic-trusty-liberty 2016-02-11 23:08:32 +0000
+++ tests/012-basic-trusty-liberty 2016-02-15 13:22:03 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/python1#!/usr/bin/env python
2#2#
3# Copyright (c) 2015 Midokura SARL, All Rights Reserved.3# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
4#4#
55
=== modified file 'tests/basic_deployment.py'
--- tests/basic_deployment.py 2016-02-11 23:08:32 +0000
+++ tests/basic_deployment.py 2016-02-15 13:22:03 +0000
@@ -36,8 +36,6 @@
36 midonet_origin=None):36 midonet_origin=None):
37 self.os_release = openstack_origin37 self.os_release = openstack_origin
38 self.series = ubuntu_series38 self.series = ubuntu_series
39 self.midonet_release = (openstack_origin.split('-')[-1] + '/' +
40 midonet_origin)
41 self.midonet_origin = midonet_origin39 self.midonet_origin = midonet_origin
42 self.mem = self.midonet_origin[:3] == 'mem'40 self.mem = self.midonet_origin[:3] == 'mem'
43 self.mem_credentials = {'mem-username': os.getenv('MEM_USERNAME'),41 self.mem_credentials = {'mem-username': os.getenv('MEM_USERNAME'),
@@ -65,16 +63,15 @@
65 self._initialize_tests()63 self._initialize_tests()
6664
67 def _add_services(self):65 def _add_services(self):
68 self.d.add('mysql', charm='cs:trusty/mysql', units=1,66 self.d.add('mysql', charm='mysql', units=1,
69 series=self.series)67 series=self.series)
70 self.d.add('keystone', charm='keystone', units=1, series=self.series,68 self.d.add('keystone', charm='keystone', units=1,
71 branch='cs:trusty/keystone')69 series=self.series)
72 self.d.add('cassandra', charm='cs:trusty/cassandra',70 self.d.add('cassandra', charm='cassandra',
73 units=1, series=self.series)71 units=1, series=self.series)
74 self.d.add('zookeeper', charm='cs:trusty/zookeeper', units=1,72 self.d.add('zookeeper', charm='zookeeper', units=1,
75 series=self.series)73 series=self.series)
76 self.d.add('compute', charm='nova-compute', units=1,74 self.d.add('compute', charm='nova-compute', units=1,
77 branch='lp:~celebdor/charms/trusty/nova-compute/trunk',
78 series=self.series, constraints={'mem': "4G"})75 series=self.series, constraints={'mem': "4G"})
79 self.d.add('midonet-api', charm='midonet-api', units=1,76 self.d.add('midonet-api', charm='midonet-api', units=1,
80 branch='lp:~celebdor/charms/trusty/midonet-api/trunk',77 branch='lp:~celebdor/charms/trusty/midonet-api/trunk',
@@ -117,16 +114,12 @@
117 'flat-interface': 'eth0',114 'flat-interface': 'eth0',
118 'manage-neutron-plugin-legacy-mode': 'false'})115 'manage-neutron-plugin-legacy-mode': 'false'})
119116
120 api_config = {'midonet-release': self.midonet_release}117 midonet_config = {'midonet-origin': self.midonet_origin,
121 if self.mem:118 'openstack-origin': self.os_release}
122 api_config.update(self.mem_credentials)119 if self.mem:
123 self.d.configure('midonet-api', api_config)120 midonet_config.update(self.mem_credentials)
124121 self.d.configure('midonet-api', midonet_config)
125 agent_config = {'midonet-origin': self.midonet_origin,122 self.d.configure('midonet-agent', midonet_config)
126 'openstack-origin': self.os_release}
127 if self.mem:
128 agent_config.update(self.mem_credentials)
129 self.d.configure('midonet-agent', agent_config)
130123
131 def _deploy(self):124 def _deploy(self):
132 try:125 try:
133126
=== modified file 'unit_tests/test_context.py'
--- unit_tests/test_context.py 2016-02-11 11:14:48 +0000
+++ unit_tests/test_context.py 2016-02-15 13:22:03 +0000
@@ -43,29 +43,15 @@
43 test.CharmTestCase.setUp(self, services.base.hookenv, HOOKENV_PATCHES)43 test.CharmTestCase.setUp(self, services.base.hookenv, HOOKENV_PATCHES)
4444
45 def lsb_release():45 def lsb_release():
46 ubuntu_trusty = {46 return {
47 'DISTRIB_ID': 'Ubuntu',47 'DISTRIB_ID': 'Ubuntu',
48 'DISTRIB_RELEASE': '14.04',48 'DISTRIB_RELEASE': '14.04',
49 'DISTRIB_CODENAME': 'trusty',49 'DISTRIB_CODENAME': 'trusty',
50 'DISTRIB_DESCRIPTION': "Ubuntu 14.04.3 LTS",50 'DISTRIB_DESCRIPTION': "Ubuntu 14.04.3 LTS",
51 }51 }
5252
53 try:
54 data = services.host.lsb_release()
55 except Exception:
56 return ubuntu_trusty
57 if data.get('DISTRIB_ID') != 'Ubuntu':
58 return ubuntu_trusty
59 return data
60
61 def get_os_codename_package(pkg, fatal=True):53 def get_os_codename_package(pkg, fatal=True):
62 version = 'liberty'54 return 'liberty'
63 try:
64 ret_vers = services.helpers_utils.get_os_codename_package(
65 pkg, fatal)
66 except Exception:
67 return version
68 return ret_vers
6955
70 self.patch_all(services.utils,56 self.patch_all(services.utils,
71 ('get_os_codename_package',57 ('get_os_codename_package',

Subscribers

People subscribed via source and target branches