Skip to content

Commit

Permalink
Extract test helpers metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoCeratto authored and Federico Ceratto committed Jun 22, 2023
1 parent 11f565f commit 8ccad7f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 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.76) unstable; urgency=medium

* Extract test helpers metadata

-- Federico Ceratto <[email protected]> Tue, 20 Jun 2023 18:46:54 +0100

fastpath (0.75) unstable; urgency=medium

* Mark certain Signal msmts as failed #679
Expand Down
4 changes: 4 additions & 0 deletions fastpath/fastpath/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,8 @@ def process_measurement(msm_tup) -> None:
sw_version = measurement.get("software_version", "unknown")
test_version = g_or(measurement, "test_version", "")
test_runtime = g_or(measurement, "test_runtime", 0.0)
test_helper_address = g(measurement, "test_helpers", "backend", "address", default="")
test_helper_type = g(measurement, "test_helpers", "backend", "type", default="")

annot = measurement.get("annotations")
if not isinstance(annot, dict):
Expand All @@ -1675,6 +1677,8 @@ def process_measurement(msm_tup) -> None:
architecture,
engine_name,
engine_version,
test_helper_address,
test_helper_type,
)

tn = measurement.get("test_name")
Expand Down
12 changes: 10 additions & 2 deletions fastpath/fastpath/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def _click_create_table_fastpath() -> None:
`test_runtime` Float32,
`architecture` String,
`engine_name` String,
`engine_version` String
`engine_version` String,
`test_helper_address` String,
`test_helper_type` String
)
ENGINE = ReplacingMergeTree
ORDER BY (measurement_start_time, report_id, input)
Expand Down Expand Up @@ -156,6 +158,8 @@ def clickhouse_upsert_summary(
architecture: str,
engine_name: str,
engine_version: str,
test_helper_address: str,
test_helper_type: str,
) -> None:
"""Insert a row in the fastpath table. Overwrite an existing one."""
sql_insert = dedent(
Expand All @@ -182,7 +186,9 @@ def clickhouse_upsert_summary(
test_runtime,
architecture,
engine_name,
engine_version
engine_version,
test_helper_address,
test_helper_type
) VALUES
"""
)
Expand Down Expand Up @@ -227,6 +233,8 @@ def tf(v: bool) -> str:
architecture=architecture,
engine_name=engine_name,
engine_version=engine_version,
test_helper_address=test_helper_address,
test_helper_type=test_helper_type,
)

settings = {"priority": 5}
Expand Down
12 changes: 9 additions & 3 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 ) VALUES "
"engine_version, test_helper_address, test_helper_type ) VALUES "
)
assert query == query_exp
assert qparams == [
Expand All @@ -151,6 +151,8 @@ def test_score_web_connectivity_bug_610_2(fprints):
"architecture": "arm",
"engine_name": "ooniprobe-engine",
"engine_version": "3.15.2",
"test_helper_address": "https://0.th.ooni.org",
"test_helper_type": "https",
}
]

Expand All @@ -168,7 +170,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 ) VALUES "
"engine_version, test_helper_address, test_helper_type ) VALUES "
)
assert query == query_exp
assert qparams == [
Expand All @@ -195,6 +197,8 @@ def test_score_browser_web(fprints):
"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 @@ -216,7 +220,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 ) VALUES "
"engine_version, test_helper_address, test_helper_type ) VALUES "
)
assert query == query_exp
assert qparams == [
Expand All @@ -243,6 +247,8 @@ def test_score_openvpn():
"architecture": "amd64",
"engine_name": "ooniprobe-engine",
"engine_version": "3.17.0-alpha",
"test_helper_address": "",
"test_helper_type": "",
}
]

Expand Down

0 comments on commit 8ccad7f

Please sign in to comment.