~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/tests/cells/test_cells_rpc_driver.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-09-09 13:11:11 UTC
  • mfrom: (1.1.74)
  • Revision ID: package-import@ubuntu.com-20130909131111-aw02ice50wac9tma
Tags: 1:2013.2~b3-0ubuntu1
* New usptream release. 
* debian/patches/avoid_requirements_cheetah.patch: Dropped
* debian/patches/fix-sqlalchemy-0.7.9-usage.patch: Dropped
* debian/patches/fix-requirements.patch: Refreshed.
* debian/patches/path-to-the-xenhost.conf-fixup.patch: Refreshed
* debian/control: Add python-jinja2
* debian/control: Dropped python-cheetah

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
Tests For Cells RPC Communication Driver
17
17
"""
18
18
 
 
19
import urlparse
 
20
 
19
21
from oslo.config import cfg
20
22
 
21
23
from nova.cells import messaging
105
107
 
106
108
        call_info = {}
107
109
 
108
 
        def _fake_make_msg(method, **kwargs):
 
110
        def _fake_make_msg(method, namespace, **kwargs):
109
111
            call_info['rpc_method'] = method
110
112
            call_info['rpc_kwargs'] = kwargs
111
113
            return 'fake-message'
115
117
            call_info['cast_kwargs'] = kwargs
116
118
 
117
119
        self.stubs.Set(rpc, 'cast_to_server', _fake_cast_to_server)
118
 
        self.stubs.Set(self.driver.intercell_rpcapi, 'make_msg',
 
120
        self.stubs.Set(self.driver.intercell_rpcapi, 'make_namespaced_msg',
119
121
                       _fake_make_msg)
120
122
        self.stubs.Set(self.driver.intercell_rpcapi, 'cast_to_server',
121
123
                       _fake_cast_to_server)
143
145
 
144
146
        call_info = {}
145
147
 
146
 
        def _fake_make_msg(method, **kwargs):
 
148
        def _fake_make_msg(method, namespace, **kwargs):
147
149
            call_info['rpc_method'] = method
148
150
            call_info['rpc_kwargs'] = kwargs
149
151
            return 'fake-message'
154
156
 
155
157
        self.stubs.Set(rpc, 'fanout_cast_to_server',
156
158
                       _fake_fanout_cast_to_server)
157
 
        self.stubs.Set(self.driver.intercell_rpcapi, 'make_msg',
 
159
        self.stubs.Set(self.driver.intercell_rpcapi, 'make_namespaced_msg',
158
160
                       _fake_make_msg)
159
161
        self.stubs.Set(self.driver.intercell_rpcapi,
160
162
                       'fanout_cast_to_server', _fake_fanout_cast_to_server)
229
231
        url = "rabbit://u:p@h:10/virtual?ssl=1"
230
232
        self.assertRaises(ValueError, rpc_driver.parse_transport_url, url)
231
233
 
 
234
    def test_query_string_old_urlparse(self):
 
235
        # Test parse_transport_url with urlparse.urlparse behaving as in python
 
236
        # 2.7.3 or below. See https://bugs.launchpad.net/nova/+bug/1202149
 
237
        url = "rabbit://u:p@h:10/virtual?ssl=1"
 
238
 
 
239
        parse_result = urlparse.ParseResult(
 
240
            scheme='rabbit', netloc='u:p@h:10', path='/virtual?ssl=1',
 
241
            params='', query='', fragment=''
 
242
        )
 
243
 
 
244
        self.mox.StubOutWithMock(urlparse, 'urlparse')
 
245
        urlparse.urlparse(url).AndReturn(parse_result)
 
246
        self.mox.ReplayAll()
 
247
 
 
248
        self.assertRaises(ValueError, rpc_driver.parse_transport_url, url)
 
249
 
 
250
    def test_query_string_new_urlparse(self):
 
251
        # Test parse_transport_url with urlparse.urlparse behaving as in python
 
252
        # 2.7.4 or above. See https://bugs.launchpad.net/nova/+bug/1202149
 
253
        url = "rabbit://u:p@h:10/virtual?ssl=1"
 
254
 
 
255
        parse_result = urlparse.ParseResult(
 
256
            scheme='rabbit', netloc='u:p@h:10', path='/virtual',
 
257
            params='', query='ssl=1', fragment=''
 
258
        )
 
259
 
 
260
        self.mox.StubOutWithMock(urlparse, 'urlparse')
 
261
        urlparse.urlparse(url).AndReturn(parse_result)
 
262
        self.mox.ReplayAll()
 
263
 
 
264
        self.assertRaises(ValueError, rpc_driver.parse_transport_url, url)
 
265
 
232
266
    def test_empty(self):
233
267
        url = "rabbit:"
234
268