Specify and plan M3b: the runner and the tools
A draft spec for the owner's review and 13 offline tasks with their given tests: shared tool arguments and host rules in proto, the sealed fetch target (M3a finding 14), the toolkit tools and SOCKS5 egress proxy, and brokerd's [runner], podman argument lists, runtime and proxy lifecycle. Each task's tests were run against a reference at that task's end state (560 to 638 tests, clippy clean); the reference is not in the repository. Adds the runner-unavailable runbook entry and tip T23 (ETXTBSY in script tests). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
//! Host names and patterns, shared by `brokerd` and `toolkit`'s egress proxy. The full tables are
|
||||
//! in `crates/brokerd/tests/args.rs`, which reaches these through `brokerd::args`. Do not edit.
|
||||
|
||||
use proto::hosts::{host_matches, valid_host, valid_host_pattern};
|
||||
|
||||
#[test]
|
||||
fn hosts() {
|
||||
for good in ["example.com", "a.b.example.com", "x-1.example.org", "a.b"] {
|
||||
assert!(valid_host(good), "{good}");
|
||||
}
|
||||
for bad in [
|
||||
"",
|
||||
"example",
|
||||
"Example.com",
|
||||
"-a.com",
|
||||
"a-.com",
|
||||
"a..com",
|
||||
".a.com",
|
||||
"a.com.",
|
||||
"127.0.0.1",
|
||||
"127.1",
|
||||
"1.2.3.4x",
|
||||
"[::1]",
|
||||
"a_b.com",
|
||||
"a.com:443",
|
||||
"*.a.com",
|
||||
] {
|
||||
assert!(!valid_host(bad), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn patterns() {
|
||||
assert!(valid_host_pattern("example.com"));
|
||||
assert!(valid_host_pattern("*.example.com"));
|
||||
for bad in ["*", "*.", "*.*.a.com", "a.*.com", "**.a.com", "*a.com"] {
|
||||
assert!(!valid_host_pattern(bad), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn matching() {
|
||||
assert!(host_matches("example.com", "example.com"));
|
||||
assert!(!host_matches("example.com", "www.example.com"));
|
||||
assert!(host_matches("*.example.com", "www.example.com"));
|
||||
assert!(host_matches("*.example.com", "a.b.example.com"));
|
||||
assert!(!host_matches("*.example.com", "example.com"));
|
||||
assert!(!host_matches("*.example.com", "badexample.com"));
|
||||
assert!(!host_matches("*.example.com", ".example.com"));
|
||||
}
|
||||
Reference in New Issue
Block a user