Skip to content

Commit

Permalink
Add more tests for the hourly workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Jan 23, 2025
1 parent bc7fbeb commit 32b945d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
8 changes: 0 additions & 8 deletions oonipipeline/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ def clickhouse_server(docker_ip, docker_services):
yield url


@pytest.fixture(scope="session")
def airflow(docker_ip, docker_services):
"""Ensure that HTTP service is up and responsive."""
port = docker_services.port_for("airflow", 8080)
url = "{}:{}".format(docker_ip, port)
yield url


@pytest.fixture
def datadir():
config.data_dir = str(DATA_DIR)
Expand Down
15 changes: 15 additions & 0 deletions oonipipeline/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ def test_full_workflow(
assert not list_all_table_diffs.called
assert make_create_queries_mock.called

result = cli_runner.invoke(
cli,
[
"run",
"--start-at",
"2022-10-21T01:00:00",
"--end-at",
"2022-10-22T02:00:00",
"--probe-cc",
"BA",
"--test-name",
"web_connectivity",
],
)
assert result.exit_code == 0

def test_build_timestamps():
start = datetime.strptime("2024-01-01 01", "%Y-%m-%d %H")
Expand Down
16 changes: 16 additions & 0 deletions oonipipeline/tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,19 @@ def test_observation_workflow(datadir, db):
obs_count_2 = bucket_dict[bucket_date]

assert obs_count == obs_count_2


def test_observation_workflow_hourly(datadir, db):
bucket_date = "2022-10-21T01"
obs_params = MakeObservationsParams(
probe_cc=["IT"],
test_name=["web_connectivity"],
fast_fail=False,
bucket_date=bucket_date,
clickhouse=db.clickhouse_url,
data_dir=datadir,
)
wf_res = make_observations(obs_params)

assert wf_res["measurement_count"] == 1814
assert wf_res["total_size"] == 33597397

0 comments on commit 32b945d

Please sign in to comment.