Skip to content

Commit

Permalink
Add tests for the make_analysis operation
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Jan 24, 2025
1 parent 155d48d commit e65dd55
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions oonipipeline/tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
)


def get_obs_count_by_cc(
def get_metric_count_by_cc(
clickhouse_url: str, table_name: str, start_day: str, end_day: str
) -> Dict[str, int]:
with ClickhouseConnection(clickhouse_url) as db:
Expand Down Expand Up @@ -67,10 +67,17 @@ def test_make_file_entry_batch(datadir, db):
MakeAnalysisParams(
probe_cc=["IR"],
clickhouse_url=db.clickhouse_url,
test_name=["webconnectivity"],
test_name=["web_connectivity"],
timestamp=date(2023, 10, 31).strftime("%Y-%m-%d"),
),
)
cnt_by_cc = get_metric_count_by_cc(
clickhouse_url=db.clickhouse_url,
start_day="2023-10-31",
end_day="2023-11-01",
table_name="analysis_web_measurement",
)
assert cnt_by_cc["IR"] == 453


def test_write_observations(measurements, netinfodb, db):
Expand Down Expand Up @@ -102,7 +109,7 @@ def test_write_observations(measurements, netinfodb, db):
assert len(obs_idxs) == len(set(obs_idxs))
db.write_table_model_rows(obs_list)
db.close()
cnt_by_cc = get_obs_count_by_cc(
cnt_by_cc = get_metric_count_by_cc(
clickhouse_url=db.clickhouse_url,
start_day="2020-01-01",
end_day="2023-12-01",
Expand Down

0 comments on commit e65dd55

Please sign in to comment.