def test_run_actions_single_and_multi_params(self): content = """ benchmark: siege/0: siege: time: 30s concurrency: 10 mongodb: perf """ test_plan = yaml.load(content) mock_client = MagicMock() with patch( 'cloudweatherreport.cloud_weather_report.run_action', autospec=True, side_effect=[self.make_benchmark_data(), self.make_benchmark_data()]) as mock_cr: result = cloud_weather_report.run_actions( test_plan, mock_client, self.make_env_status()) calls = [call(mock_client, 'siege/0', 'siege', action_param={"time": "30s", "concurrency": 10}), call(mock_client, 'mongodb/0', 'perf', action_param=None)] self.assertItemsEqual(mock_cr.mock_calls, calls) self.assertEqual(result, [ {"perf": self.make_benchmark_data()["meta"]["composite"]}, {"siege": self.make_benchmark_data()["meta"]["composite"]}])
def test_run_actions_benchmark_with_no_param(self): content = """ benchmark: siege/0: siege """ test_plan = yaml.load(content) mock_client = MagicMock() with patch('cloudweatherreport.cloud_weather_report.run_action', autospec=True, return_value=self.make_benchmark_data()) as mock_cr: result = cloud_weather_report.run_actions( test_plan, mock_client, self.make_env_status()) calls = [call(mock_client, 'siege/0', 'siege', action_param=None)] self.assertEqual(mock_cr.mock_calls, calls) self.assertEqual(result, [ {"siege": self.make_benchmark_data()["meta"]["composite"]}])
def test_run_actions(self): content = """ tests: - foo-test - bar-test benchmark: siege/0: siege: time: 30s concurrency: 10 """ test_plan = yaml.load(content) mock_client = MagicMock() with patch('cloudweatherreport.cloud_weather_report.run_action', autospec=True, return_value=self.make_benchmark_data()) as mock_cr: result = cloud_weather_report.run_actions( test_plan, mock_client, self.make_env_status()) calls = [call(mock_client, 'siege/0', 'siege', action_param={"time": "30s", "concurrency": 10})] self.assertEqual(mock_cr.mock_calls, calls) self.assertEqual(result, [ {"siege": self.make_benchmark_data()["meta"]["composite"]}])