diff options
author | Yun Huang <yun.huang@windriver.com> | 2018-03-28 13:23:01 +0800 |
---|---|---|
committer | Yun Huang <yun.huang@windriver.com> | 2018-03-28 13:23:01 +0800 |
commit | 5a4a7d74efb9a86823f7650a080d3b58e18c8078 (patch) | |
tree | 5f9764e59a1097198dc64da722237b5ae1197246 /ocata | |
parent | 2f56599f278527cad0ff3c4d00319cdf990924d4 (diff) |
Ocata capacity_check_volume_limits_outofstorage
Change-Id: I30528936349d45225217f8ee0df348aa24d73bb2
Issue-ID: MULTICLOUD-203
Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'ocata')
-rw-r--r-- | ocata/ocata/resource/tests/test_capacity.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ocata/ocata/resource/tests/test_capacity.py b/ocata/ocata/resource/tests/test_capacity.py index ded870b8..0f1fc160 100644 --- a/ocata/ocata/resource/tests/test_capacity.py +++ b/ocata/ocata/resource/tests/test_capacity.py @@ -43,6 +43,16 @@ MOCK_GET_HYPER_STATATICS_RESPONSE = { } } +MOCK_GET_STORAGE_RESPONSE_OOS = { + "limits": { + "rate": [], + "absolute": { + "totalGigabytesUsed": 498, + "maxTotalVolumeGigabytes": 500, + } + } +} + MOCK_GET_TENANT_LIMIT_RESPONSE_OUTOFRAM = { "limits": { "rate": [], @@ -240,3 +250,26 @@ class TestCapacity(test_base.TestRequest): data=json.dumps(TEST_REQ_SUCCESS_SOURCE), content_type='application/json', HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) + + @mock.patch.object(VimDriverUtils, 'get_session') + @mock.patch.object(VimDriverUtils, 'get_vim_info') + def test_capacity_check_volume_limits_outofstorage(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), + self._get_mock_response(MOCK_GET_HYPER_STATATICS_RESPONSE), + self._get_mock_response(MOCK_GET_STORAGE_RESPONSE_OOS), + ] + }) + + response = self.client.post( + "/api/multicloud-ocata/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) + + self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual({"result": False}, response.data) + |