Skip to content

feat(stats): report testrun stats to the tcache - #3717

Open
OlufemiAdeOlusile wants to merge 1 commit into
masterfrom
add-stats-upload
Open

OlufemiAdeOlusile wants to merge 1 commit into
masterfrom
add-stats-upload

Conversation

@OlufemiAdeOlusile

@OlufemiAdeOlusile OlufemiAdeOlusile commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

The tcache has a /stats endpoint (mkoura/testing-results-cache#25), but nothing calls it, so no test run records its counts or its duration.

This adds the client half. scripts/stats_json.py builds a small JSON document from the Allure results: the counts, grouped by historyId like count_test_results.py, plus the run identity, duration, versions and CLI coverage. runner/report_stats.sh uploads it with one PUT: one row per regression run, one row per upgrade step under one run id. Each runner/env_* file names its run, a typed CI_TESTRUN_NAME wins and marks a release, and the run id is GITHUB_RUN_ID. The upload is off unless ENABLE_TCACHE_STATS is truthy and reuses TCACHE_BASIC_AUTH and TCACHE_URL. Every call is || : with a curl timeout, so it cannot change the exit code or hold up a run. The reusable workflows now pass the secrets to the test step; upgrade_reusable.yaml did not declare them at all.

Tested on a laptop against a real tcache under gunicorn behind Caddy: a smoke regression run of 79 tests and a full three-step upgrade run of 5,450 tests from 11.1.3 to 11.2.0, each stored and read back from /stats/runs, the upgrade as one run with three steps. A broken submit count turned the check red. With the flag off, the secrets missing, the tcache down, a wrong password, a 404, a 500 or no answer, the caller keeps its exit code. No unit tests, the same as count_test_results.py.

Safe to merge before the server side, as the upload is off by default. Set the ENABLE_TCACHE_STATS repository variable once /stats is deployed. The nightly and leios workflows still do not pass the secrets (#3624).

Comment thread scripts/stats_json.py Fixed
The tcache has a /stats endpoint, but nothing calls it, so no test
run records how many tests it ran or how long it took.

scripts/stats_json.py builds a small JSON document from the Allure
results: the counts, grouped by historyId the same way as
count_test_results.py, plus the run identity, the wall-clock
duration, the node and CLI versions and the CLI coverage numbers.
runner/report_stats.sh uploads it with one PUT. regression.sh sends
one row per run and node_upgrade_pytest.sh one row per step.

A run is identified by project, testrun name, run id, step and
origin. Each workflow's runner/env_* file names its run through
TCACHE_TESTRUN_NAME; a typed CI_TESTRUN_NAME wins and marks the run
as a release. The run id is GITHUB_RUN_ID on CI. A local upgrade run
gets one id from node_upgrade.sh, exported as TCACHE_RUN_ID, so its
steps are stored as one run. A run under MARKEXPR or
DESELECT_FROM_FILE is marked filtered.

The upload is off unless ENABLE_TCACHE_STATS is truthy. It reuses
TCACHE_BASIC_AUTH and TCACHE_URL, every call is "|| :" and curl has
a timeout, so it can neither change the exit code nor hold up a run.
The reusable workflows pass the tcache secrets and the flag to the
test step; upgrade_reusable.yaml did not declare the secrets at all.
The nightly, nightly-cli, nightly-dbsync and regression-leios
workflows still do not pass them (#3624).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants