def test_influx_service(on_try): if ON_TRY and sys.platform == "darwin": # macos slave in the CI are restricted return mocks() with running_on_try(on_try), temp_dir() as output: args = { "verbose": True, "output": output, "perfboard-influx-password": "******", "perfboard-grafana-key": "xxx", "perfboard-grafana-host": "grafana", "perfboard-influx-port": 0, "perfboard-influx-host": "influxdb", "tests": [EXAMPLE_TEST], } mach_cmd, metadata, env = get_running_env(**args) metadata.add_result({"results": str(BT_DATA), "name": "browsertime"}) layer = Influx(env, mach_cmd) layer.setup() try: metadata = layer.run(metadata) finally: layer.teardown() index = on_try and 2 or 1 sent_data = responses.calls[index].request.body.split(b"\n") fields = [line.split(b",")[0].strip() for line in sent_data] assert b"rumspeedindex" in fields responses.reset()
def test_test_runner_coverage(*mocked): # simulating with coverage not installed with running_on_try(False), _get_command(PerftestTests) as test: old = list(sys.meta_path) sys.meta_path = [] try: test.run_tests(tests=[EXAMPLE_TEST]) finally: sys.meta_path = old
def test_test_runner_coverage(*mocked): from mozperftest.mach_commands import run_tests # simulating with coverage not installed with running_on_try(False), _get_command(run_tests) as (cmd, command_context): old = list(sys.meta_path) sys.meta_path = [] try: cmd(command_context, tests=[EXAMPLE_TEST]) finally: sys.meta_path = old
def test_push_command_several_platforms(push_to_try, venv): with running_on_try(False), _get_command() as test: # , silence(test): test.run_perftest( tests=[EXAMPLE_TEST], flavor="desktop-browser", push_to_try=True, try_platform=["linux", "mac"], ) push_to_try.assert_called() name, args, kwargs = push_to_try.mock_calls[0] params = kwargs["try_task_config"]["parameters"]["try_task_config"] assert "perftest-linux-try-browsertime" in params["tasks"] assert "perftest-macosx-try-browsertime" in params["tasks"]
def test_fzf_nothing_selected(*mocked): with running_on_try(False), _get_command() as (cmd, command_context), silence(): cmd(command_context, flavor="desktop-browser")
def test_test_runner_on_try(*mocked): from mozperftest.mach_commands import run_tests # simulating on try to run the paths parser with running_on_try(), _get_command(run_tests) as (cmd, command_context): cmd(command_context, tests=[EXAMPLE_TEST])
def test_test_runner(*mocked): from mozperftest.mach_commands import run_tests with running_on_try(False), _get_command(run_tests) as (cmd, command_context): cmd(command_context, tests=[EXAMPLE_TEST], verbose=True)
def test_fzf_nothing_selected(*mocked): with running_on_try(False), _get_command() as test, silence(): test.run_perftest(flavor="desktop-browser")
def test_test_runner_on_try(*mocked): # simulating on try to run the paths parser with running_on_try(), _get_command(PerftestTests) as test: test.run_tests(tests=[EXAMPLE_TEST])
def test_test_runner(*mocked): with running_on_try(False), _get_command(PerftestTests) as test: test.run_tests(tests=[EXAMPLE_TEST], verbose=True)
def test_fzf_flavor(*mocked): with running_on_try(False), _get_command() as test: # , silence(): test.run_perftest(test, flavor="desktop-browser")