def test_top_level_error_is_correctly_reported(self): # Verify that a top-level error doesn't cause an exception to be thrown. # In a top-level error case, result dict doesn't contain entry per host paramiko_runner = ParamikoRemoteScriptRunner('runner_1') paramiko_runner.runner_parameters = { 'username': '******', 'hosts': '127.0.0.1' } paramiko_runner.action = ACTION_1 paramiko_runner.liveaction_id = 'foo' paramiko_runner.entry_point = 'foo' paramiko_runner.context = {} paramiko_runner._cwd = '/tmp' paramiko_runner._copy_artifacts = Mock(side_effect=Exception('fail!')) status, result, _ = paramiko_runner.run(action_parameters={}) self.assertEqual(status, LIVEACTION_STATUS_FAILED) self.assertEqual(result['failed'], True) self.assertEqual(result['succeeded'], False) self.assertTrue('Failed copying content to remote boxes' in result['error'])
def test_top_level_error_is_correctly_reported(self): # Verify that a top-level error doesn't cause an exception to be thrown. # In a top-level error case, result dict doesn't contain entry per host paramiko_runner = ParamikoRemoteScriptRunner('runner_1') paramiko_runner.runner_parameters = { 'username': '******', 'hosts': '127.0.0.1' } paramiko_runner.action = ACTION_1 paramiko_runner.liveaction_id = 'foo' paramiko_runner.entry_point = 'foo' paramiko_runner.context = {} paramiko_runner._cwd = '/tmp' paramiko_runner._copy_artifacts = Mock(side_effect=Exception('fail!')) status, result, _ = paramiko_runner.run(action_parameters={}) self.assertEqual(status, LIVEACTION_STATUS_FAILED) self.assertEqual(result['failed'], True) self.assertEqual(result['succeeded'], False) self.assertIn('Failed copying content to remote boxes', result['error'])
def test_top_level_error_is_correctly_reported(self): # Verify that a top-level error doesn't cause an exception to be thrown. # In a top-level error case, result dict doesn't contain entry per host paramiko_runner = ParamikoRemoteScriptRunner("runner_1") paramiko_runner.runner_parameters = { "username": "******", "hosts": "127.0.0.1", } paramiko_runner.action = ACTION_1 paramiko_runner.liveaction_id = "foo" paramiko_runner.entry_point = "foo" paramiko_runner.context = {} paramiko_runner._cwd = "/tmp" paramiko_runner._copy_artifacts = Mock(side_effect=Exception("fail!")) status, result, _ = paramiko_runner.run(action_parameters={}) self.assertEqual(status, LIVEACTION_STATUS_FAILED) self.assertEqual(result["failed"], True) self.assertEqual(result["succeeded"], False) self.assertIn("Failed copying content to remote boxes", result["error"])