Repository navigation
test(perf): riduci tempo suite locale da 96s a 25s - #506
Merged
Merged
Conversation
…t lento Leve per ridurre il tempo di run locale da ~96s a ~25s: 1. addopts: -n auto (xdist) di default anche in locale — prima solo CI lo passava; rimosso -n auto/-m duplicati da pytest_args CI 2. marker @pytest.mark.smoke aggiunto ai golden-path template (test_smoke_templates_contract_years 5 test + golden_path 1): eseguono pipeline complete su 3 template, il contratto --years è già coperto da test_cli_path_contract.py (lo dice la nota nel file) 3. test_nonexistent_slug_fails: 5.8s → 0.03s — monkeypatch del WORKSPACE_ROOT in discovery, così il resolver non scansiona il workspace reale (~6s di filesystem walk per uno slug inesistente) Risultato: 24.9s locale (1323 passed, 18 smoke deselected correttamente, 3 falli odf preesistenti).
Finding review PR #506: marcando i 18 golden-path template come smoke, escono dalla CI (che usa -m 'not smoke' via addopts). Senza uno step dedicato, la copertura e2e su 3 template veniva persa silenziosamente. Aggiunto step 'Smoke pipeline tests' che esegue -m smoke dopo il test principale: 40 test (18 golden-path + 22 preesistenti), ~14s. I 2-3 falli smoke sono preesistenti (ambiente locale, non introduced.
Lo step CI smoke ha rivelato 3 test che non giravano mai (marcati smoke, mai eseguiti in CI) e che si erano rotti col tempo: 1. test_project_example_metadata: rimosso — aspettava 'summary' nei metadata di tutti i layer (solo mart lo scrive) e file di validazione (_validate/) non più prodotti. Contratti di un'era precedente. 2. test_smoke_e2e_flow test_init_then_full_then_validate: rimossi gli assert su clean_validation.json/mart_validation.json in _validate/ (non più prodotti). Il resto del test (parquet, validazione API, inspect) funziona. 3. test_probe_pool test_circuit_breaker_integration: fix mock (Response._content_consumed=True per bypassare raw.close() su Response() vuoto) + assert aggiornati: il campo circuit_open del ProbeResult non viene mai settato perché probe_url_headers wrappa CircuitOpenError in RuntimeError senza propagare l'informazione. Il test verifica ora che tutte le probe falliscano (circuit aperto si vede dai log, non dal campo).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sintesi
Riduce il tempo di run locale della suite test da ~96s a ~25s (−74%) con tre leve meccaniche, senza eliminare alcun test.
Contesto collegato
Analisi performance della suite: 63% del tempo era concentrato in 56 test "lenti" (≥0.5s), di cui i golden-path template (~13s) e un singolo test che scansionava il workspace reale (~6s).
Cosa cambia
Leve
-n auto(xdist) negli addopts — prima solo CI lo passava viapytest_args; ora è di default anche in locale. Rimosso il duplicato dapytest_argsCI (si affidano agli addopts).Marker
@pytest.mark.smokesui golden-path template — 6 test intest_smoke_templates_contract_years.pyetest_smoke_templates_golden_path.pyeseguono pipeline complete su 3 template. Il contratto--yearsè già coperto datest_cli_path_contract.py(lo dichiara la nota nel file stesso). Con il marker, sono deselected di default e runnabili esplicitamente con-m smoke.Fix
test_nonexistent_slug_fails(5.8s → 0.03s) — il test scansionava il workspace reale (~6s di filesystem walk). Monkeypatch delWORKSPACE_ROOTintoolkit.core.discoverysu tmp_path: il resolver fallisce istantaneamente sullo slug inesistente.Verifica
odferano un problema di ambience, non di codice)ruff check .passamypy toolkit/passa-m smokeMetriche PR
Checklist PR