Merge lp:~hopem/charm-helpers/lp1456876 into lp:charm-helpers

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 557
Proposed branch: lp:~hopem/charm-helpers/lp1456876
Merge into: lp:charm-helpers
Diff against target: 36 lines (+21/-0)
2 files modified
charmhelpers/contrib/openstack/context.py (+12/-0)
tests/contrib/openstack/test_os_contexts.py (+9/-0)
To merge this branch: bzr merge lp:~hopem/charm-helpers/lp1456876
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+290701@code.launchpad.net
To post a comment you must log in.
lp:~hopem/charm-helpers/lp1456876 updated
558. By Edward Hope-Morley

add unit test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/context.py'
2--- charmhelpers/contrib/openstack/context.py 2016-01-29 10:20:29 +0000
3+++ charmhelpers/contrib/openstack/context.py 2016-04-01 10:18:26 +0000
4@@ -1479,3 +1479,15 @@
5 if self.context_complete(ctxt):
6 return ctxt
7 return {}
8+
9+
10+class InternalEndpointContext(OSContextGenerator):
11+ """Internal endpoint context.
12+
13+ This context provides the endpoint type used for communication between
14+ services e.g. between Nova and Cinder internally. Openstack uses Public
15+ endpoints by default so this allows admins to optionally use internal
16+ endpoints.
17+ """
18+ def __call__(self):
19+ return {'use_internal_endpoints': config('use-internal-endpoints')}
20
21=== modified file 'tests/contrib/openstack/test_os_contexts.py'
22--- tests/contrib/openstack/test_os_contexts.py 2016-01-29 10:20:29 +0000
23+++ tests/contrib/openstack/test_os_contexts.py 2016-04-01 10:18:26 +0000
24@@ -2883,3 +2883,12 @@
25 relation = FakeRelation(relation_data=QUANTUM_NETWORK_SERVICE_RELATION_VERSIONED)
26 self.relation_get.side_effect = relation.get
27 self.assertEquals(context.NetworkServiceContext()(), data_result)
28+
29+ def test_internal_endpoint_context(self):
30+ config = {'use-internal-endpoints': False}
31+ self.config.side_effect = fake_config(config)
32+ ctxt = context.InternalEndpointContext()
33+ self.assertFalse(ctxt()['use_internal_endpoints'])
34+ config = {'use-internal-endpoints': True}
35+ self.config.side_effect = fake_config(config)
36+ self.assertTrue(ctxt()['use_internal_endpoints'])

Subscribers

People subscribed via source and target branches