summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud/resource/tests
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-28 12:08:06 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-28 12:08:06 +0800
commit287e8006941824872efeff8b663fc2bf4301a980 (patch)
tree4650e9df66323bebaec3af59bd1058b0090556b4 /windriver/titanium_cloud/resource/tests
parente036fae046cb359ac3e8d8402d86ac2ecf47771d (diff)
Add TC test_capacity_check_nova_limits_outofram
Change-Id: I4c398e8446493df4fc1ea293c30adf64b0662b64 Issue-ID: MULTICLOUD-203 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/resource/tests')
-rw-r--r--windriver/titanium_cloud/resource/tests/test_capacity.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/windriver/titanium_cloud/resource/tests/test_capacity.py b/windriver/titanium_cloud/resource/tests/test_capacity.py
index 5a967a53..14840832 100644
--- a/windriver/titanium_cloud/resource/tests/test_capacity.py
+++ b/windriver/titanium_cloud/resource/tests/test_capacity.py
@@ -52,6 +52,18 @@ MOCK_GET_HYPER_STATATICS_RESPONSE_OUTOFVCPU = {
}
}
+MOCK_GET_TENANT_LIMIT_RESPONSE_OUTOFRAM = {
+ "limits": {
+ "rate": [],
+ "absolute": {
+ "maxTotalRAMSize": 128 * 1024,
+ "totalRAMUsed": 1 * 1024,
+ "totalCoresUsed": 4,
+ "maxTotalCores": 20,
+ }
+ }
+}
+
MOCK_GET_HYPER_STATATICS_RESPONSE_OUTOFRAM = {
"hypervisor_statistics" : {
"vcpus_used" : 4,
@@ -210,3 +222,22 @@ class TestCapacity(test_base.TestRequest):
self.assertEquals(status.HTTP_200_OK, response.status_code)
self.assertEqual({"result": False}, response.data)
+
+ @mock.patch.object(VimDriverUtils, 'get_session')
+ @mock.patch.object(VimDriverUtils, 'get_vim_info')
+ def test_capacity_check_nova_limits_outofram(self, mock_get_vim_info, mock_get_session):
+ mock_get_vim_info.return_value = mock_info.MOCK_VIM_INFO
+ mock_get_session.return_value = test_base.get_mock_session(
+ ["get"], {
+ "side_effect": [
+ self._get_mock_response(MOCK_GET_TENANT_LIMIT_RESPONSE_OUTOFRAM),
+ self._get_mock_response(MOCK_GET_HYPER_STATATICS_RESPONSE),
+ self._get_mock_response(MOCK_GET_STORAGE_RESPONSE),
+ ]
+ })
+
+ response = self.client.post(
+ "/api/multicloud-titanium_cloud/v0/windriver-hudson-dc_RegionOne/capacity_check",
+ data=json.dumps(TEST_REQ_SUCCESS_SOURCE),
+ content_type='application/json',
+ HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)