ci(lesavka): keep test categories canonical

This commit is contained in:
Brad Stein 2026-05-17 18:26:33 -03:00
parent 32b058973e
commit 0fb382127d
8 changed files with 31 additions and 15 deletions

View File

@ -414,15 +414,15 @@ path = "tests/e2e/server/rct/server_rct_output_probe_e2e_contract.rs"
[[test]]
name = "client_install_script_contract"
path = "tests/installer/scripts/install/client_install_script_contract.rs"
path = "tests/contract/scripts/install/client_install_script_contract.rs"
[[test]]
name = "server_install_script_contract"
path = "tests/installer/scripts/install/server_install_script_contract.rs"
path = "tests/contract/scripts/install/server_install_script_contract.rs"
[[test]]
name = "install_version_path_contract"
path = "tests/installer/scripts/install/install_version_path_contract.rs"
path = "tests/contract/scripts/install/install_version_path_contract.rs"
[[test]]
name = "relay_proto_integration_contract"

View File

@ -356,10 +356,10 @@ def testing_contract_violations() -> list[str]:
taxonomy_dir = root / 'tests'
required_categories = {
'unit', 'component', 'integration', 'api', 'contract', 'e2e', 'system',
'performance', 'reliability', 'chaos', 'security', 'ui', 'installer',
'compatibility', 'regression', 'smoke', 'fixtures', 'helpers', 'golden',
'manual',
'performance', 'reliability', 'chaos', 'security', 'ui',
'compatibility', 'regression', 'smoke', 'manual',
}
support_categories = {'fixtures', 'helpers', 'golden'}
if not taxonomy_dir.exists():
return ['tests: missing repository-level test taxonomy directory']
@ -370,6 +370,10 @@ def testing_contract_violations() -> list[str]:
}
for category in sorted(required_categories - present_categories):
violations.append(f'tests/{category}: missing standard test category directory')
for category in sorted(present_categories - required_categories - support_categories):
violations.append(
f'tests/{category}: top-level test folders must be a real test category or support data'
)
test_files = [
file

View File

@ -78,6 +78,18 @@ counts = {'passed': 0, 'failed': 0, 'ignored': 0, 'measured': 0, 'filtered': 0}
test_cases = []
current_target = ''
test_category_names = {
'api', 'chaos', 'compatibility', 'component', 'contract', 'e2e',
'integration', 'manual', 'performance', 'regression', 'reliability',
'security', 'smoke', 'system', 'ui', 'unit',
}
support_category_names = {'fixtures', 'golden', 'helpers'}
def normalize_category(category: str) -> str:
if category in test_category_names or category in support_category_names:
return category
return 'uncategorized'
manifest_path = pathlib.Path('tests/test-taxonomy-manifest.json')
category_by_path = {}
category_by_test_name = {}
@ -85,11 +97,11 @@ test_categories = set()
if manifest_path.exists():
for item in json.loads(manifest_path.read_text(encoding='utf-8')):
path = item.get('new', '')
category = item.get('category', '')
category = normalize_category(item.get('category', ''))
if path and category:
category_by_path[path] = category
category_by_test_name[pathlib.PurePosixPath(path).stem] = category
if category not in {'fixtures', 'golden', 'helpers'}:
if category in test_category_names:
test_categories.add(category)
def category_for_path(path: str) -> str:
@ -97,7 +109,7 @@ def category_for_path(path: str) -> str:
return category_by_path[path]
parts = pathlib.PurePosixPath(path).parts
if len(parts) >= 2 and parts[0] == 'tests':
return parts[1]
return normalize_category(parts[1])
if path.startswith('src/'):
return 'unit'
return 'uncategorized'

View File

@ -166,8 +166,8 @@ fn audio_epoch_ui_security_install_and_diagnostics_are_backstopped() {
path: "tests/security/server/upstream_media/upstream_media_payload_security_contract.rs",
},
EvidencePath {
category: "installer",
path: "tests/installer/scripts/install/install_version_path_contract.rs",
category: "contract",
path: "tests/contract/scripts/install/install_version_path_contract.rs",
},
EvidencePath {
category: "contract",

View File

@ -40,8 +40,8 @@
"new": "tests/regression/client/input/inputs/client_inputs_toggle_contract.rs"
},
{
"category": "installer",
"new": "tests/installer/scripts/install/client_install_script_contract.rs"
"category": "contract",
"new": "tests/contract/scripts/install/client_install_script_contract.rs"
},
{
"category": "regression",
@ -228,8 +228,8 @@
"new": "tests/regression/server/gadget/server_gadget_recovery_contract.rs"
},
{
"category": "installer",
"new": "tests/installer/scripts/install/server_install_script_contract.rs"
"category": "contract",
"new": "tests/contract/scripts/install/server_install_script_contract.rs"
},
{
"category": "contract",