Files
leleka/control-plane/tests/mcp_hub/harness.rs
T
Pavlo Ratushnyi b4db01728c Keep the Strata files Rust and the product read in third_party/strata (STRA-406)
Owner decision 2026-11-23: the vendored Strata tree engine/strata is removed for good. This first step moves what is still read
at build, test or ship time into one small directory, byte for byte:

- third_party/strata/LICENSE (MIT; `leleka engine license` embeds it, the packagers ship it)
- third_party/strata/ggml/LICENSE, project-maya/LICENSE, project-maya/NOTICE.md (licence texts the release packager ships)
- third_party/strata/serve/chat_template.jinja (one copy, embedded by control-plane server_api.rs and gateway-text prompt.rs)
- third_party/strata/serve/chat_golden.json (gateway-text prompt tests)
- third_party/strata/tests/data/native_experts/*.txt (control-plane native_pack tests)
- control-plane/tests/mcp_hub/mcp_fake_server.py next to its test harness
- third_party/strata/UPSTREAM.md replaces engine/upstream.md: pin 41cf05a0, URL, the 25 locally patched files, where the removed tree is in history

include_str! paths, deploy/build.rs (the `leleka version` Strata pin now reads third_party/strata/UPSTREAM.md), Dockerfile.static-cli,
.dockerignore, .gitattributes, the release packagers (package-5090.sh, package-release.py: the subtree facts of the removed tree are
dropped from PROVENANCE) and the evidence capture scripts follow the move. The tree itself is deleted in a later commit.
2026-11-23 21:11:53 +01:00

45 lines
1.5 KiB
Rust

//! Fake servers and hub builders of the MCP hub tests.
use leleka_control_plane::mcp::{Hub, Settings};
use serde_json::{Map, Value, json};
use std::collections::BTreeMap;
use std::path::PathBuf;
use std::process::{Command, Stdio};
pub(super) fn fake_path() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/mcp_hub/mcp_fake_server.py")
}
pub(super) fn python() -> Option<&'static str> {
Command::new("python3")
.arg("--version")
.stdout(Stdio::null())
.status()
.ok()
.filter(|s| s.success())
.map(|_| "python3")
}
pub(super) fn stdio(args: &[&str], log: Option<&PathBuf>) -> Map<String, Value> {
let mut all = vec![fake_path().to_string_lossy().into_owned()];
all.extend(args.iter().map(|a| (*a).to_owned()));
let mut config = json!({"command": "python3", "args": all});
if let Some(log) = log {
config["env"] = json!({"FAKE_MCP_LOG": log});
}
config.as_object().unwrap().clone()
}
pub(super) fn hub(servers: Vec<(&str, Map<String, Value>)>, settings: Settings) -> Hub {
Hub::new(servers.into_iter().map(|(n, c)| (n.to_owned(), c)).collect::<BTreeMap<_, _>>(), settings)
}
pub(super) fn names(status: &Value, server: &str) -> Vec<String> {
status["servers"].as_array().unwrap().iter().find(|s| s["name"] == server).unwrap()["tools"]
.as_array()
.unwrap()
.iter()
.map(|t| t["name"].as_str().unwrap().to_owned())
.collect()
}