def test_collect_kpi(self, ssh): mock_ssh(ssh, exec_result=(0, "success", "")) ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0) ping_traffic_gen._queue = Queue() ping_traffic_gen._queue.put({}) ping_traffic_gen.collect_kpi() self.assertEqual(ping_traffic_gen._result, {})
def test_collect_kpi(self): with mock.patch("yardstick.ssh.SSH") as ssh: vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] ssh_mock = mock.Mock(autospec=ssh.SSH) ssh_mock.execute = \ mock.Mock(return_value=(0, "", "")) ssh.from_node.return_value = ssh_mock ping_traffic_gen = PingTrafficGen(vnfd) ping_traffic_gen._queue = Queue() ping_traffic_gen._queue.put({}) ping_traffic_gen.collect_kpi() self.assertEqual({}, ping_traffic_gen._result)
def test_collect_kpi(self, ssh, *args): mock_ssh(ssh, exec_result=(0, "success", "")) ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0) ping_traffic_gen.scenario_helper.scenario_cfg = { 'nodes': { ping_traffic_gen.name: "mock" } } ping_traffic_gen._queue = Queue() ping_traffic_gen._queue.put({}) expected = {'physical_node': 'mock_node', 'collect_stats': {}} # NOTE: Why we check _result but not collect_kpi() return value # self.assertEqual(ping_traffic_gen._result, {}) self.assertEqual(ping_traffic_gen.collect_kpi(), expected)