This commit is contained in:
Raphael Pierzina 2022-03-15 16:52:57 +01:00
Родитель abbab3e38d
Коммит b3331363de
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: EC76CBD357802B88
1 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -11,6 +11,7 @@ from typing import Any, Callable
import pytest
from click.testing import CliRunner, Result
from burnham import metrics
from burnham.cli import burnham
@ -163,3 +164,40 @@ def test_cli_restore_test_run_and_test_name(
assert monkeypatch_set_upload_enabled.values == [False, True]
assert monkeypatch_space_ship_ready.counter == 1
assert monkeypatch_discovery.counter == 4
def test_cli_metrics(
monkeypatch_space_ship_ready,
monkeypatch_discovery,
monkeypatch_starbase46,
run_cli: Callable,
) -> None:
"""Test that the CLI app sets Glean metrics as expected."""
missions = [
"MISSION A: ONE WARP",
"MISSION G: FIVE WARPS, FOUR JUMPS",
]
test_run = uuid.uuid4()
test_name = "test_cli"
airflow_task_id = "client5"
result = run_cli(
f"--test-run={test_run}",
f"--test-name={test_name}",
f"--airflow-task-id={airflow_task_id}",
"--platform=localhost:0",
"--spore-drive=tardigrade-dna",
*missions,
)
assert result.exit_code == 0
assert metrics.test.run.test_get_value() == test_run
assert metrics.test.name.test_get_value() == test_name
assert metrics.test.airflow_task_id.test_get_value() == airflow_task_id
assert monkeypatch_space_ship_ready.counter == 1
assert monkeypatch_discovery.counter == 2
assert monkeypatch_starbase46.counter == 0