From 0ef60856fb2f1f1fd83647c3422e1b510a871ebd Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Thu, 7 Mar 2013 00:01:29 +0000 Subject: 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 --- nova/tests/compute/test_host_api.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'nova/tests') 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( -- cgit