summaryrefslogtreecommitdiffstats
path: root/ocata
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-07-04 18:40:09 +0800
committerYun Huang <yun.huang@windriver.com>2018-07-04 18:40:09 +0800
commit1ef4d132b8e9bd99ac88fe4bd1a023c97ca58ad9 (patch)
treea8d238ee4f4ed12955d790e934aa0d15470efa1e /ocata
parent59680b9172a05cad9a4a1490457cc7a2524a3c12 (diff)
Add ocata UT for vesagent tasks_processOneBacklog
Change-Id: Ic7bde6002c7ad752120c08f4b839bf1e9e66257f Issue-ID: MULTICLOUD-230 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'ocata')
-rw-r--r--ocata/ocata/vesagent/tests_tasks.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/ocata/ocata/vesagent/tests_tasks.py b/ocata/ocata/vesagent/tests_tasks.py
index 82cc59c9..bd47133f 100644
--- a/ocata/ocata/vesagent/tests_tasks.py
+++ b/ocata/ocata/vesagent/tests_tasks.py
@@ -23,6 +23,7 @@ from django.core.cache import cache
from common.msapi import extsys
from ocata.vesagent import tasks
+from ocata.vesagent.event_domain import fault_vm
@@ -104,3 +105,33 @@ class VesTaskTest(unittest.TestCase):
COUNT_TIME_SLOT = (1, 10)
self.assertEquals(COUNT_TIME_SLOT, result)
pass
+
+ @mock.patch.object(fault_vm, 'processBacklog_fault_vm')
+ def test_tasks_processOneBacklog(self, mock_fault_vm_processBacklog_fault_vm):
+ mock_fault_vm_processBacklog_fault_vm.return_value = None
+ vesagent_config = {"backlogs": [{"backlog_uuid": "ce2d7597-22e1-4239-890f-bc303bd67076",
+ "server_id": "c4b575fa-ed85-4642-ab4b-335cb5744721",
+ "tenant_id": "0e148b76ee8c42f78d37013bf6b7b1ae", "api_method": "GET",
+ "source": "onap-aaf",
+ "api_link": "/onaplab_RegionOne/compute/v2.1/0e148b76ee8c42f78d37013bf6b7b1ae/servers/c4b575fa-ed85-4642-ab4b-335cb5744721",
+ "domain": "fault", "type": "vm", "tenant": "VIM"}],
+ "poll_interval_default": 10, "vimid": "onaplab_RegionOne",
+ "subscription": {"username": "user", "password": "password",
+ "endpoint": "http://127.0.0.1:9005/sample"}}
+
+ vesagent_onebacklog = {"backlog_uuid": "ce2d7597-22e1-4239-890f-bc303bd67076",
+ "poll_interval": 10,
+ "server_id": "c4b575fa-ed85-4642-ab4b-335cb5744721",
+ "tenant_id": "0e148b76ee8c42f78d37013bf6b7b1ae", "api_method": "GET",
+ "source": "onap-aaf",
+ "api_link": "/onaplab_RegionOne/compute/v2.1/0e148b76ee8c42f78d37013bf6b7b1ae/servers/c4b575fa-ed85-4642-ab4b-335cb5744721",
+ "domain": "fault", "type": "vm", "tenant": "VIM"}
+
+ result = tasks.processOneBacklog(vesAgentConfig = vesagent_config,
+ vesAgentState = {},
+ poll_interval_default = 10,
+ oneBacklog = vesagent_onebacklog)
+ COUNT_TIME_SLOT = (1, 10)
+ self.assertEquals(COUNT_TIME_SLOT, result)
+ pass
+