fix: reject standalone runtime selectors
This commit is contained in:
@@ -755,6 +755,12 @@ fn parse_console_options<R: CliConnectionResolver + ?Sized>(
|
||||
}
|
||||
|
||||
if target.kind() == TargetKind::Standalone {
|
||||
if runtime_id.is_some() || worker_id.is_some() {
|
||||
return Err(ParseError(
|
||||
"Standalone does not accept Backend Runtime selectors; use --backend with --runtime-id/--worker-id"
|
||||
.to_string(),
|
||||
));
|
||||
}
|
||||
if session.is_some() {
|
||||
return Err(ParseError(
|
||||
"--local does not accept legacy --session; use --local --resume for Standalone session restore"
|
||||
@@ -2045,6 +2051,25 @@ backend = "shared"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_standalone_rejects_backend_runtime_selectors() {
|
||||
let runtime_error = parse_args_from(["--local", "--runtime-id", "runtime-a"])
|
||||
.unwrap_err()
|
||||
.to_string();
|
||||
assert!(runtime_error.contains("Standalone does not accept Backend Runtime selectors"));
|
||||
|
||||
let worker_error = parse_args_from([
|
||||
"--local",
|
||||
"--runtime-id",
|
||||
"runtime-a",
|
||||
"--worker-id",
|
||||
"worker-b",
|
||||
])
|
||||
.unwrap_err()
|
||||
.to_string();
|
||||
assert!(worker_error.contains("Standalone does not accept Backend Runtime selectors"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_backend_runtime_target_requires_runtime_for_worker_identity() {
|
||||
let err = parse_args_from(["--backend", "http://127.0.0.1:8787", "--worker-id", "w"])
|
||||
|
||||
Reference in New Issue
Block a user