コード例 #1
0
    def test_wait_for_instantiate_fragmented(self, ssh, _):
        mock_ssh(ssh)

        mock_process = mock.Mock(autospec=Process)
        mock_process.is_alive.return_value = True
        mock_process.exitcode = 432

        # test that fragmented pipeline prompt is recognized
        mock_q_out = mock.Mock(autospec=Queue)
        mock_q_out.get.side_effect = iter(["wow pipel", "ine>"])
        mock_q_out.qsize.side_effect = range(2, -1, -1)

        mock_resource = mock.MagicMock()

        vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
        vpe_approx_vnf._vnf_process = mock_process
        vpe_approx_vnf.q_out = mock_q_out
        vpe_approx_vnf.queue_wrapper = mock.Mock(autospec=QueueFileWrapper)
        vpe_approx_vnf.resource_helper.resource = mock_resource

        self.assertEqual(vpe_approx_vnf.wait_for_instantiate(), 432)
コード例 #2
0
ファイル: test_vpe_vnf.py プロジェクト: Kryndex/yardstick
    def test_wait_for_instantiate(self, ssh):
        mock_ssh(ssh)

        mock_process = mock.Mock(autospec=Process)
        mock_process.is_alive.return_value = True
        mock_process.exitcode = 432

        mock_q_out = mock.Mock(autospec=Queue)
        mock_q_out.get.side_effect = iter(["pipeline>"])
        mock_q_out.qsize.side_effect = range(1, -1, -1)

        mock_resource = mock.MagicMock()

        vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
        vpe_approx_vnf._vnf_process = mock_process
        vpe_approx_vnf.q_out = mock_q_out
        vpe_approx_vnf.queue_wrapper = mock.Mock(autospec=QueueFileWrapper)
        vpe_approx_vnf.resource_helper.resource = mock_resource

        vpe_approx_vnf.q_out.put("pipeline>")
        self.assertEqual(vpe_approx_vnf.wait_for_instantiate(), 432)