test: complete grpc data solution validation
This commit is contained in:
@@ -62,7 +62,8 @@ def discover_names(output):
|
||||
if marker not in output:
|
||||
return []
|
||||
names = []
|
||||
for line in output.split(marker, 1)[1].splitlines():
|
||||
# VSTest separates records by LF and can print Unicode controls in arguments.
|
||||
for line in output.split(marker, 1)[1].split("\n"):
|
||||
value = line.strip()
|
||||
if line[:1].isspace() and re.match(r"^[\w.+`]+\.[\w`]+(?:\(.*\))?$", value):
|
||||
names.append(value)
|
||||
@@ -126,6 +127,14 @@ def validate_trx(directory, started_ns, expected_classes=(), excluded_methods=()
|
||||
return {"executed": total_executed, "files": summaries, "executed_classes": sorted(executed_classes)}
|
||||
|
||||
|
||||
# These network-free guards live beside their integration fixture implementation.
|
||||
# No other integration classes or project-wide selector can enter a unit phase.
|
||||
INTEGRATION_UNIT_GUARDS = {
|
||||
"tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests.csproj": {"LocalFixtureEndpointGuardTests"},
|
||||
"tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Sql.IntegrationTests/ZB.MOM.WW.OtOpcUa.Driver.Sql.IntegrationTests.csproj": {"OwnedBlackholeControlGuardTests"},
|
||||
"tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests.csproj": {"AbLegacyFixtureEndpointGuardTests"},
|
||||
}
|
||||
|
||||
def selected_records(manifest, phase, root, case):
|
||||
if phase not in manifest or not manifest[phase]:
|
||||
raise GateError(f"unknown or empty phase: {phase}")
|
||||
@@ -133,11 +142,17 @@ def selected_records(manifest, phase, root, case):
|
||||
for source in manifest[phase]:
|
||||
item = dict(source)
|
||||
project = Path(item["project"])
|
||||
if project.is_absolute() or ".." in project.parts or project.suffix != ".csproj" or "IntegrationTests" in str(project):
|
||||
declared = item.get("new_classes", []) + item.get("existing_classes", [])
|
||||
permitted_guards = INTEGRATION_UNIT_GUARDS.get(project.as_posix(), set())
|
||||
integration_guards = bool(declared) and set(declared).issubset(permitted_guards) and item.get("integration_unit_guards") is True
|
||||
if project.is_absolute() or ".." in project.parts or project.suffix != ".csproj" or ("IntegrationTests" in str(project) and not integration_guards):
|
||||
raise GateError(f"unit project must be an exact repository-relative unit csproj: {project}")
|
||||
if not (root / project).is_file():
|
||||
raise GateError(f"missing unit project: {project}")
|
||||
classes = item.get("new_classes", []) + item.get("existing_classes", [])
|
||||
if integration_guards:
|
||||
exact_classes = "|".join("FullyQualifiedName~." + name + "." for name in sorted(set(declared)))
|
||||
item["filter"] = "Category=Unit&(" + exact_classes + ")"
|
||||
if case and case not in classes:
|
||||
continue
|
||||
if case:
|
||||
|
||||
Reference in New Issue
Block a user