Skip to content

Commit 3a0efc2

Browse files
committed
test(mxc): parse OpenClaw config schema portably
Signed-off-by: Prekshi Vyas <[email protected]>
1 parent f3beffe commit 3a0efc2

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-driver-mxc/Cargo.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ openshell-policy = { path = "../openshell-policy" }
5858
base64 = { workspace = true }
5959
rustls = { workspace = true }
6060
serde_json = { workspace = true }
61+
# Parse shipped gateway templates in cross-platform drift guards.
62+
toml = { workspace = true }
6163
# Used by the drift guard test (handled_fields_inventory) to parse YAML into a
6264
# generic serde_json::Value for key enumeration.
6365
serde_yml = { workspace = true }

‎crates/openshell-driver-mxc/tests/openclaw_appcontainer_compat.rs‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,21 @@ fn runner_uses_lifecycle_readiness_and_preserves_failure_diagnostics() {
100100

101101
#[test]
102102
fn openclaw_gateway_configs_declare_the_current_schema() {
103-
for config in [
104-
PROCESS_CONTAINER_CONFIG,
105-
ISOLATION_CONFIG,
106-
LOCAL_NETWORK_CONFIG,
103+
for (name, config) in [
104+
("process-container", PROCESS_CONTAINER_CONFIG),
105+
("isolation", ISOLATION_CONFIG),
106+
("local-network", LOCAL_NETWORK_CONFIG),
107107
] {
108-
assert!(config.contains("[openshell]\nversion = 2"));
108+
let config = config
109+
.parse::<toml::Value>()
110+
.unwrap_or_else(|error| panic!("{name} config must be valid TOML: {error}"));
111+
assert_eq!(
112+
config
113+
.get("openshell")
114+
.and_then(|openshell| openshell.get("version"))
115+
.and_then(toml::Value::as_integer),
116+
Some(2),
117+
"{name} config must declare the current OpenShell schema",
118+
);
109119
}
110120
}

0 commit comments

Comments
 (0)