Skip to content

Commit

Permalink
Add ooni_run_link_id support
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoCeratto committed Nov 15, 2023
1 parent cfb9ac3 commit 36ea57e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
6 changes: 6 additions & 0 deletions fastpath/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
fastpath (0.84) unstable; urgency=medium

* Support ooni_run_link_id

-- Federico Ceratto <federico@debian.org> Fri, 03 Nov 2023 12:14:54 +0100

fastpath (0.83) unstable; urgency=medium

* Flag Signal msmts from 0.2.3 as failed as well
Expand Down
4 changes: 4 additions & 0 deletions fastpath/fastpath/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,10 @@ def process_measurement(msm_tup, buffer_writes=False) -> None:
engine_name = g_or(annot, "engine_name", "")
engine_version = g_or(annot, "engine_version", "")
blocking_type = g(scores, "analysis", "blocking_type", default="")
ooni_run_link_id = g_or(annot, "ooni_run_link_id", "")

# TODO: build an object or typed dict here instead of passing args by
# position. Move the dict from db.py "new = dict(..."
db.clickhouse_upsert_summary(
measurement,
scores,
Expand All @@ -1681,6 +1684,7 @@ def process_measurement(msm_tup, buffer_writes=False) -> None:
engine_version,
test_helper_address,
test_helper_type,
ooni_run_link_id,
buffer_writes=buffer_writes,
)

Expand Down
5 changes: 4 additions & 1 deletion fastpath/fastpath/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def _write_rows_to_fastpath(rows: List[Dict]):
engine_name,
engine_version,
test_helper_address,
test_helper_type
test_helper_type,
ooni_run_link_id
) VALUES
"""
)
Expand Down Expand Up @@ -207,6 +208,7 @@ def clickhouse_upsert_summary(
engine_version: str,
test_helper_address: str,
test_helper_type: str,
ooni_run_link_id: str,
buffer_writes=False,
) -> None:
"""Insert a row in the fastpath table. Overwrite an existing one."""
Expand Down Expand Up @@ -254,6 +256,7 @@ def tf(v: bool) -> str:
engine_version=engine_version,
test_helper_address=test_helper_address,
test_helper_type=test_helper_type,
ooni_run_link_id=ooni_run_link_id,
)

if buffer_writes:
Expand Down
13 changes: 8 additions & 5 deletions fastpath/fastpath/tests/test_functional_nodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_score_web_connectivity_bug_610_2(fprints):
"probe_cc, probe_asn, test_name, test_start_time, measurement_start_time, "
"scores, platform, anomaly, confirmed, msm_failure, blocking_type, domain, software_name, "
"software_version, test_version, test_runtime, architecture, engine_name, "
"engine_version, test_helper_address, test_helper_type ) VALUES "
"engine_version, test_helper_address, test_helper_type, ooni_run_link_id ) VALUES "
)
assert query == query_exp
assert qparams == [
Expand Down Expand Up @@ -153,6 +153,7 @@ def test_score_web_connectivity_bug_610_2(fprints):
"engine_version": "3.15.2",
"test_helper_address": "https://0.th.ooni.org",
"test_helper_type": "https",
"ooni_run_link_id": "",
}
]

Expand All @@ -170,7 +171,7 @@ def test_score_browser_web(fprints):
"probe_cc, probe_asn, test_name, test_start_time, measurement_start_time, "
"scores, platform, anomaly, confirmed, msm_failure, blocking_type, domain, software_name, "
"software_version, test_version, test_runtime, architecture, engine_name, "
"engine_version, test_helper_address, test_helper_type ) VALUES "
"engine_version, test_helper_address, test_helper_type, ooni_run_link_id ) VALUES "
)
assert query == query_exp
assert qparams == [
Expand All @@ -186,19 +187,20 @@ def test_score_browser_web(fprints):
"measurement_start_time": datetime.datetime(2023, 3, 20, 18, 27, 2),
"measurement_uid": "bogus_uid",
"msm_failure": "f",
"ooni_run_link_id": "",
"platform": "unset",
"probe_asn": 577,
"probe_cc": "CA",
"report_id": "20230320T182635Z_browserweb_CA_577_n1_k3Fvk1o9okE1w7w7",
"scores": '{"blocking_general":0.0,"blocking_global":0.0,"blocking_country":0.0,"blocking_isp":0.0,"blocking_local":0.0,"extra":{"browser_name":"chrome","load_time_ms":357.40000000037253}}',
"software_name": "ooniprobe-web",
"software_version": "0.1.0",
"test_helper_address": "",
"test_helper_type": "",
"test_name": "browser_web",
"test_runtime": 0.35740000000037253,
"test_start_time": datetime.datetime(2023, 3, 20, 18, 26, 35),
"test_version": "0.1.0",
"test_helper_address": "",
"test_helper_type": "",
},
]

Expand All @@ -220,7 +222,7 @@ def test_score_openvpn():
"probe_cc, probe_asn, test_name, test_start_time, measurement_start_time, "
"scores, platform, anomaly, confirmed, msm_failure, blocking_type, domain, software_name, "
"software_version, test_version, test_runtime, architecture, engine_name, "
"engine_version, test_helper_address, test_helper_type ) VALUES "
"engine_version, test_helper_address, test_helper_type, ooni_run_link_id ) VALUES "
)
assert query == query_exp
assert qparams == [
Expand Down Expand Up @@ -249,6 +251,7 @@ def test_score_openvpn():
"engine_version": "3.17.0-alpha",
"test_helper_address": "",
"test_helper_type": "",
"ooni_run_link_id": "",
}
]

Expand Down

0 comments on commit 36ea57e

Please sign in to comment.