diff options
| author | Joe Gordon <jogo@cloudscaling.com> | 2013-03-07 00:01:29 +0000 |
|---|---|---|
| committer | Joe Gordon <jogo@cloudscaling.com> | 2013-03-07 22:30:00 +0000 |
| commit | 0ef60856fb2f1f1fd83647c3422e1b510a871ebd (patch) | |
| tree | e2d5725f1ff40d38f4f7194891492dd1773e15c7 /nova/tests | |
| parent | e23769827dbd5c9eb9d392e6452ca33253f88329 (diff) | |
Make 'os-hosts/node1' case sensitivity defer to DB
RPC is case sensitive, but URL is not, and DB can be. So pull host_name from DB
in HostAPI RPC layer instead of from passed in from URL. This means RPC will
always get the proper capitalization, and case sensitivity is defined in DB layer.
Fix bug 996879
Change-Id: I448dd4ec3aec4af1adf4487f26ea996db572fa3d
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/compute/test_host_api.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/nova/tests/compute/test_host_api.py b/nova/tests/compute/test_host_api.py index 3b5a9b871..38a7d2c37 100644 --- a/nova/tests/compute/test_host_api.py +++ b/nova/tests/compute/test_host_api.py @@ -38,8 +38,10 @@ class ComputeHostAPITestCase(test.TestCase): """Sets it so that the host API always thinks that 'fake_host' exists. """ - self.mox.StubOutWithMock(self.host_api, '_assert_host_exists') - self.host_api._assert_host_exists(self.ctxt, 'fake_host') + def fake_assert_host_exists(context, host_name): + return 'fake_host' + self.stubs.Set(self.host_api, '_assert_host_exists', + fake_assert_host_exists) def test_set_host_enabled(self): self._mock_assert_host_exists() @@ -53,6 +55,18 @@ class ComputeHostAPITestCase(test.TestCase): 'fake_enabled') self.assertEqual('fake-result', result) + def test_host_name_from_assert_hosts_exists(self): + self._mock_assert_host_exists() + self._mock_rpc_call( + {'method': 'set_host_enabled', + 'args': {'enabled': 'fake_enabled'}, + 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION}) + + self.mox.ReplayAll() + result = self.host_api.set_host_enabled(self.ctxt, 'fake_hosT', + 'fake_enabled') + self.assertEqual('fake-result', result) + def test_get_host_uptime(self): self._mock_assert_host_exists() self._mock_rpc_call( |
