def testWaitForResponsesSuccess(self, mock_func): vm1 = mock.Mock() vm1.RemoteCommand.side_effect = [('', ''), ('2 results', '')] vm2 = mock.Mock() vm2.RemoteCommand.side_effect = [('', ''), ('2 results', '')] large_scale_boot_benchmark._WaitForResponses([vm1, vm2]) vm1.RemoteCommand.assert_called_with('wc -l /tmp/pkb/results') vm2.RemoteCommand.assert_called_with('wc -l /tmp/pkb/results')
def testWaitForResponsesTwice(self, mock_func): vm1 = mock.Mock() vm1.RemoteCommand.side_effect = [('', ''), ('2', ''), ('', ''), ('5', '')] large_scale_boot_benchmark._WaitForResponses([vm1]) self.assertEqual(vm1.RemoteCommand.call_count, 4)
def testWaitForResponsesDeadServer(self, mock_func): vm1 = mock.Mock() vm1.RemoteCommand.side_effect = [('Error: Failed', ''), ('2', '')] with self.assertRaises(errors.Benchmarks.RunError): large_scale_boot_benchmark._WaitForResponses([vm1])