ci(lesavka): keep test categories canonical
This commit is contained in:
parent
32b058973e
commit
0fb382127d
@ -414,15 +414,15 @@ path = "tests/e2e/server/rct/server_rct_output_probe_e2e_contract.rs"
|
|||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "client_install_script_contract"
|
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]]
|
[[test]]
|
||||||
name = "server_install_script_contract"
|
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]]
|
[[test]]
|
||||||
name = "install_version_path_contract"
|
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]]
|
[[test]]
|
||||||
name = "relay_proto_integration_contract"
|
name = "relay_proto_integration_contract"
|
||||||
|
|||||||
@ -356,10 +356,10 @@ def testing_contract_violations() -> list[str]:
|
|||||||
taxonomy_dir = root / 'tests'
|
taxonomy_dir = root / 'tests'
|
||||||
required_categories = {
|
required_categories = {
|
||||||
'unit', 'component', 'integration', 'api', 'contract', 'e2e', 'system',
|
'unit', 'component', 'integration', 'api', 'contract', 'e2e', 'system',
|
||||||
'performance', 'reliability', 'chaos', 'security', 'ui', 'installer',
|
'performance', 'reliability', 'chaos', 'security', 'ui',
|
||||||
'compatibility', 'regression', 'smoke', 'fixtures', 'helpers', 'golden',
|
'compatibility', 'regression', 'smoke', 'manual',
|
||||||
'manual',
|
|
||||||
}
|
}
|
||||||
|
support_categories = {'fixtures', 'helpers', 'golden'}
|
||||||
if not taxonomy_dir.exists():
|
if not taxonomy_dir.exists():
|
||||||
return ['tests: missing repository-level test taxonomy directory']
|
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):
|
for category in sorted(required_categories - present_categories):
|
||||||
violations.append(f'tests/{category}: missing standard test category directory')
|
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 = [
|
test_files = [
|
||||||
file
|
file
|
||||||
|
|||||||
@ -78,6 +78,18 @@ counts = {'passed': 0, 'failed': 0, 'ignored': 0, 'measured': 0, 'filtered': 0}
|
|||||||
test_cases = []
|
test_cases = []
|
||||||
current_target = ''
|
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')
|
manifest_path = pathlib.Path('tests/test-taxonomy-manifest.json')
|
||||||
category_by_path = {}
|
category_by_path = {}
|
||||||
category_by_test_name = {}
|
category_by_test_name = {}
|
||||||
@ -85,11 +97,11 @@ test_categories = set()
|
|||||||
if manifest_path.exists():
|
if manifest_path.exists():
|
||||||
for item in json.loads(manifest_path.read_text(encoding='utf-8')):
|
for item in json.loads(manifest_path.read_text(encoding='utf-8')):
|
||||||
path = item.get('new', '')
|
path = item.get('new', '')
|
||||||
category = item.get('category', '')
|
category = normalize_category(item.get('category', ''))
|
||||||
if path and category:
|
if path and category:
|
||||||
category_by_path[path] = category
|
category_by_path[path] = category
|
||||||
category_by_test_name[pathlib.PurePosixPath(path).stem] = 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)
|
test_categories.add(category)
|
||||||
|
|
||||||
def category_for_path(path: str) -> str:
|
def category_for_path(path: str) -> str:
|
||||||
@ -97,7 +109,7 @@ def category_for_path(path: str) -> str:
|
|||||||
return category_by_path[path]
|
return category_by_path[path]
|
||||||
parts = pathlib.PurePosixPath(path).parts
|
parts = pathlib.PurePosixPath(path).parts
|
||||||
if len(parts) >= 2 and parts[0] == 'tests':
|
if len(parts) >= 2 and parts[0] == 'tests':
|
||||||
return parts[1]
|
return normalize_category(parts[1])
|
||||||
if path.startswith('src/'):
|
if path.startswith('src/'):
|
||||||
return 'unit'
|
return 'unit'
|
||||||
return 'uncategorized'
|
return 'uncategorized'
|
||||||
|
|||||||
@ -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",
|
path: "tests/security/server/upstream_media/upstream_media_payload_security_contract.rs",
|
||||||
},
|
},
|
||||||
EvidencePath {
|
EvidencePath {
|
||||||
category: "installer",
|
category: "contract",
|
||||||
path: "tests/installer/scripts/install/install_version_path_contract.rs",
|
path: "tests/contract/scripts/install/install_version_path_contract.rs",
|
||||||
},
|
},
|
||||||
EvidencePath {
|
EvidencePath {
|
||||||
category: "contract",
|
category: "contract",
|
||||||
|
|||||||
@ -40,8 +40,8 @@
|
|||||||
"new": "tests/regression/client/input/inputs/client_inputs_toggle_contract.rs"
|
"new": "tests/regression/client/input/inputs/client_inputs_toggle_contract.rs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "installer",
|
"category": "contract",
|
||||||
"new": "tests/installer/scripts/install/client_install_script_contract.rs"
|
"new": "tests/contract/scripts/install/client_install_script_contract.rs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "regression",
|
"category": "regression",
|
||||||
@ -228,8 +228,8 @@
|
|||||||
"new": "tests/regression/server/gadget/server_gadget_recovery_contract.rs"
|
"new": "tests/regression/server/gadget/server_gadget_recovery_contract.rs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "installer",
|
"category": "contract",
|
||||||
"new": "tests/installer/scripts/install/server_install_script_contract.rs"
|
"new": "tests/contract/scripts/install/server_install_script_contract.rs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "contract",
|
"category": "contract",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user