Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ci/layers.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ paths = [
paths = ["**/*.md"]

# The SDK suites that exercise the storage-node contract: what a STORAGE
# change escalates to instead of every SDK unit test.
# change escalates to instead of every SDK unit test. Each is a module of
# dsm_sdk's library; the selector's self-test refuses a name that no longer
# resolves to one, because a filter that matches nothing runs nothing and
# still passes.
[sdk_node_protocol]
lib_filters = [
"handlers::storage_routes",
"sdk::storage_node_sdk",
"sdk::b0x_sdk",
"sdk::storage_set",
"sdk::storage_sync_sdk",
"sdk::storage_node_health",
]
integration_tests = ["b0x_integration", "storage_full_lifecycle"]

# The Rust test matrix groups the selector emits, and what each runs.
[groups.dsm]
Expand All @@ -90,7 +90,7 @@ run = "cargo test --locked -p dsm_sdk --release -- --nocapture --test-threads=1"
[groups.sdk-node-protocol]
when = ["SDK_NODE_PROTOCOL"]
unless = ["SDK"]
run = "cargo test --locked -p dsm_sdk --release --lib -- --nocapture --test-threads=1 {lib_filters}\ncargo test --locked -p dsm_sdk --release {integration_tests} -- --nocapture --test-threads=1"
run = "cargo test --locked -p dsm_sdk --release --lib -- --nocapture --test-threads=1 {lib_filters}"

[groups.workspace-rest]
when = ["CORE", "STORAGE", "FORMAL"]
Expand Down
3 changes: 1 addition & 2 deletions ci/select_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,13 @@ def select(cfg: dict, files: list[str], event: str, preset: str | None) -> tuple
def rust_matrix(cfg: dict, layers: set[str]) -> list[dict]:
snp = cfg["sdk_node_protocol"]
lib_filters = " ".join(snp["lib_filters"])
integration = " ".join(f"--test {t}" for t in snp["integration_tests"])
include = []
for group, spec in cfg["groups"].items():
if not any(w in layers for w in spec["when"]):
continue
if any(u in layers for u in spec.get("unless", [])):
continue
run = spec["run"].replace("{lib_filters}", lib_filters).replace("{integration_tests}", integration)
run = spec["run"].replace("{lib_filters}", lib_filters)
include.append({"group": group, "run": run})
return include

Expand Down
18 changes: 16 additions & 2 deletions ci/test_select_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,22 @@ def test_storage_reaches_its_node_protocol_sdk_coverage(self):
self.assertEqual(layers, {"STORAGE", "SDK_NODE_PROTOCOL"})
self.assertEqual(groups(layers), {"sdk-node-protocol", "workspace-rest"})
run = next(g["run"] for g in sl.rust_matrix(CFG, layers) if g["group"] == "sdk-node-protocol")
self.assertIn("handlers::storage_routes", run)
self.assertIn("--test b0x_integration", run)
for module in CFG["sdk_node_protocol"]["lib_filters"]:
self.assertIn(module, run)
self.assertEqual(run.count("cargo test"), 1, run)

def test_every_named_sdk_suite_is_a_module_that_exists(self):
# A cargo test filter that matches nothing runs nothing and passes, so
# a name left behind by a deleted module narrows STORAGE's coverage
# without a signal. Each name must resolve to a module of the library.
root = Path(__file__).resolve().parent.parent
src = root / "dsm_client/deterministic_state_machine/dsm_sdk/src"
for module in CFG["sdk_node_protocol"]["lib_filters"]:
path = src.joinpath(*module.split("::"))
self.assertTrue(
path.with_suffix(".rs").is_file() or (path / "mod.rs").is_file(),
f"{module} names no module of dsm_sdk",
)

def test_storage_plus_sdk_runs_full_sdk_not_the_narrow_group(self):
layers, _ = sel(["dsm_storage_node/src/main.rs", SDK + "sdk/token_sdk.rs"])
Expand Down
Loading