650 lines
20 KiB
Rust
650 lines
20 KiB
Rust
//! CLI-level regression tests for the `sys` entry paths and contracts.
|
|
//!
|
|
//! Natural language is the default interaction (calling the AI assistant).
|
|
//! Deterministic operation is explicitly selected with `--legacy`.
|
|
//! JSON action entry points require `--legacy` or `--broker`.
|
|
|
|
use std::process::Command;
|
|
|
|
fn sys() -> Command {
|
|
Command::new(env!("CARGO_BIN_EXE_sys"))
|
|
}
|
|
|
|
fn effective_uid_is_root() -> bool {
|
|
std::process::Command::new("id")
|
|
.arg("-u")
|
|
.output()
|
|
.ok()
|
|
.map(|o| String::from_utf8_lossy(&o.stdout).trim() == "0")
|
|
.unwrap_or(false)
|
|
}
|
|
|
|
#[test]
|
|
fn natural_option_like_operand_is_rejected_in_legacy_mode() {
|
|
let out = sys()
|
|
.args(["--legacy", "--", "install", "--color=n"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("could not parse")
|
|
|| stderr.contains("invalid")
|
|
|| stderr.contains("legacy"),
|
|
"stderr: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn json_without_legacy_or_broker_is_rejected() {
|
|
let out = sys()
|
|
.args(["--action", r#"{"action":"history"}"#])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("require --legacy") || stderr.contains("--broker"),
|
|
"stderr: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn json_option_like_operand_is_rejected_in_legacy_mode() {
|
|
let out = sys()
|
|
.args([
|
|
"--legacy",
|
|
"--action",
|
|
r#"{"action":"install_package","atom":"-C"}"#,
|
|
])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(stderr.contains("invalid"), "stderr: {stderr}");
|
|
}
|
|
|
|
#[test]
|
|
fn broker_allows_action_execution() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["--broker", "--action", r#"{"action":"history"}"#])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(
|
|
out.status.success(),
|
|
"stderr: {}",
|
|
String::from_utf8_lossy(&out.stderr)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn read_only_history_succeeds_deterministically_with_legacy() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["history", "--legacy"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(
|
|
out.status.success(),
|
|
"stderr: {}",
|
|
String::from_utf8_lossy(&out.stderr)
|
|
);
|
|
let stdout = String::from_utf8_lossy(&out.stdout);
|
|
assert!(
|
|
stdout.contains("no snapshot history") || stdout.contains("snapshots:"),
|
|
"stdout: {stdout}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn history_without_legacy_and_no_model_gives_actionable_legacy_guidance() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let out = sys()
|
|
.env("PHOEBUS_AI_PROVIDER", "none")
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.arg("history")
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("sys history --legacy"),
|
|
"expected legacy suggestion in stderr: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn version_is_reported() {
|
|
let out = sys().arg("--version").output().expect("run sys");
|
|
assert!(out.status.success());
|
|
assert!(String::from_utf8_lossy(&out.stdout).contains("sys"));
|
|
}
|
|
|
|
#[test]
|
|
fn appimage_and_custom_ebuild_inventories_are_safe_and_empty_on_a_fresh_root() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
for args in [vec!["appimage", "list"], vec!["ebuilds"]] {
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.arg("--legacy")
|
|
.args(&args)
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(
|
|
out.status.success(),
|
|
"{args:?} stderr: {}",
|
|
String::from_utf8_lossy(&out.stderr)
|
|
);
|
|
let stdout = String::from_utf8_lossy(&out.stdout);
|
|
assert!(
|
|
stdout.contains("no managed AppImages")
|
|
|| stdout.contains("no Phoebus-managed custom ebuilds"),
|
|
"{args:?} stdout: {stdout}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn invalid_snap_name_via_json_fails_closed() {
|
|
let out = sys()
|
|
.args([
|
|
"--legacy",
|
|
"--action",
|
|
r#"{"action":"snap_install","name":"Bad Name"}"#,
|
|
])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
assert!(String::from_utf8_lossy(&out.stderr).contains("invalid"));
|
|
}
|
|
|
|
#[test]
|
|
fn invalid_appimage_hash_via_json_fails_closed() {
|
|
let out = sys()
|
|
.args([
|
|
"--legacy",
|
|
"--action",
|
|
r#"{"action":"appimage_acquire","name":"x","url":"https://e/x","sha256":"00"}"#,
|
|
])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
assert!(String::from_utf8_lossy(&out.stderr).contains("SHA-256"));
|
|
}
|
|
|
|
#[test]
|
|
fn a_system_wide_preference_without_root_is_refused_before_any_command() {
|
|
if effective_uid_is_root() {
|
|
return;
|
|
}
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let personal = tempfile::tempdir().expect("personal dir");
|
|
let mutating = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.env("PHOEBUS_PERSONAL_DIR", personal.path())
|
|
.args([
|
|
"--legacy",
|
|
"--action",
|
|
r#"{"action":"set_package_preference","name":"firefox","backend":"flatpak","system_wide":true}"#,
|
|
])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!mutating.status.success());
|
|
assert!(String::from_utf8_lossy(&mutating.stderr).contains("root"));
|
|
// A privileged system-wide change must never write `/etc`.
|
|
assert!(!root
|
|
.path()
|
|
.join("etc/phoebus/package-preferences.toml")
|
|
.exists());
|
|
}
|
|
|
|
#[test]
|
|
fn a_personal_preference_is_saved_by_a_normal_account_outside_etc() {
|
|
if effective_uid_is_root() {
|
|
return;
|
|
}
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let personal = tempfile::tempdir().expect("personal dir");
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.env("PHOEBUS_PERSONAL_DIR", personal.path())
|
|
.args([
|
|
"--legacy",
|
|
"--action",
|
|
r#"{"action":"set_package_preference","name":"firefox","backend":"flatpak"}"#,
|
|
])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(
|
|
out.status.success(),
|
|
"personal preference must succeed: {}",
|
|
String::from_utf8_lossy(&out.stderr)
|
|
);
|
|
// It is stored in the user's own 0600 config, never in root-owned /etc.
|
|
let saved = personal
|
|
.path()
|
|
.join(".config/phoebus/package-preferences.toml");
|
|
assert!(saved.is_file(), "expected {}", saved.display());
|
|
let text = std::fs::read_to_string(&saved).unwrap();
|
|
assert!(
|
|
text.contains("firefox") && text.contains("flatpak"),
|
|
"{text}"
|
|
);
|
|
assert!(!root
|
|
.path()
|
|
.join("etc/phoebus/package-preferences.toml")
|
|
.exists());
|
|
}
|
|
|
|
#[test]
|
|
fn a_personal_preference_does_not_require_the_root_owned_transaction_log() {
|
|
if effective_uid_is_root() {
|
|
return;
|
|
}
|
|
use std::os::unix::fs::PermissionsExt;
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let personal = tempfile::tempdir().expect("personal dir");
|
|
// Simulate the installed system: /var/lib/phoebus is root-owned, so a normal
|
|
// account cannot write the system transaction log.
|
|
let tx_dir = root.path().join("var/lib/phoebus");
|
|
std::fs::create_dir_all(&tx_dir).expect("create tx dir");
|
|
std::fs::set_permissions(&tx_dir, std::fs::Permissions::from_mode(0o555)).expect("chmod");
|
|
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.env("PHOEBUS_PERSONAL_DIR", personal.path())
|
|
.args([
|
|
"--legacy",
|
|
"--action",
|
|
r#"{"action":"set_package_preference","name":"firefox","backend":"flatpak"}"#,
|
|
])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(
|
|
out.status.success(),
|
|
"a personal preference must succeed without the system transaction log: {}",
|
|
String::from_utf8_lossy(&out.stderr)
|
|
);
|
|
// The preference was saved; no system transaction was attempted.
|
|
assert!(personal
|
|
.path()
|
|
.join(".config/phoebus/package-preferences.toml")
|
|
.is_file());
|
|
assert!(
|
|
!tx_dir.join("transactions.toml").exists(),
|
|
"no system transaction should be attempted for a personal preference"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn a_personal_preference_is_refused_when_the_initiating_uid_differs_from_the_euid() {
|
|
if effective_uid_is_root() {
|
|
return;
|
|
}
|
|
let uid = std::process::Command::new("id")
|
|
.arg("-u")
|
|
.output()
|
|
.ok()
|
|
.and_then(|o| {
|
|
String::from_utf8_lossy(&o.stdout)
|
|
.trim()
|
|
.parse::<u32>()
|
|
.ok()
|
|
})
|
|
.expect("current uid");
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let personal = tempfile::tempdir().expect("personal dir");
|
|
// Simulate `sudo` on behalf of another user without root: the initiating
|
|
// uid differs from the effective uid, so the write must be refused rather
|
|
// than creating a file owned by the wrong user.
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.env("PHOEBUS_PERSONAL_DIR", personal.path())
|
|
.env("SUDO_UID", (uid + 1).to_string())
|
|
.args([
|
|
"--legacy",
|
|
"--action",
|
|
r#"{"action":"set_package_preference","name":"firefox","backend":"flatpak"}"#,
|
|
])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
assert!(
|
|
String::from_utf8_lossy(&out.stderr).contains("refusing to write"),
|
|
"stderr: {}",
|
|
String::from_utf8_lossy(&out.stderr)
|
|
);
|
|
assert!(!personal
|
|
.path()
|
|
.join(".config/phoebus/package-preferences.toml")
|
|
.exists());
|
|
}
|
|
|
|
#[test]
|
|
fn conflicting_backend_flags_are_rejected_by_the_cli() {
|
|
let out = sys()
|
|
.args(["--flatpak", "--nix", "install", "some-app"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("cannot be used with")
|
|
|| stderr.contains("conflict")
|
|
|| stderr.contains("not allowed"),
|
|
"stderr: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn a_backend_flag_without_an_install_is_refused() {
|
|
let out = sys()
|
|
.args(["--flatpak", "history", "--legacy"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(stderr.contains("only apply to"), "stderr: {stderr}");
|
|
}
|
|
|
|
#[test]
|
|
fn legacy_install_without_source_flag_is_refused_with_choices() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["install", "firefox", "--legacy"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("requires an explicit package source flag"),
|
|
"stderr: {stderr}"
|
|
);
|
|
assert!(
|
|
stderr.contains("--flatpak") && stderr.contains("--portage"),
|
|
"stderr must show explicit options: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn source_flag_without_legacy_enters_ai_workflow_and_suggests_legacy() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let out = sys()
|
|
.env("PHOEBUS_AI_PROVIDER", "none")
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["install", "firefox", "--flatpak"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("sys install firefox --legacy --flatpak"),
|
|
"stderr must give legacy alternative: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn an_explicit_backend_never_falls_back_to_another_lane() {
|
|
if effective_uid_is_root() {
|
|
return;
|
|
}
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let empty = tempfile::tempdir().expect("empty PATH");
|
|
let out = sys()
|
|
.env("PATH", empty.path())
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["install", "some-app", "--legacy", "--portage"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("cannot satisfy") || stderr.contains("no real candidate"),
|
|
"stderr: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn an_unqualified_install_without_a_model_offers_options_and_installs_nothing() {
|
|
if effective_uid_is_root() {
|
|
return;
|
|
}
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let empty = tempfile::tempdir().expect("empty PATH");
|
|
let out = sys()
|
|
.env("PATH", empty.path())
|
|
.env("PHOEBUS_AI_PROVIDER", "none")
|
|
.env("PHOEBUS_AI_BACKEND", "direct")
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["install", "firefox"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(
|
|
!out.status.success(),
|
|
"an unqualified install must not proceed without a model"
|
|
);
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("No connected model") || stderr.contains("no AI provider"),
|
|
"stderr: {stderr}"
|
|
);
|
|
assert!(
|
|
stderr.contains("--flatpak") && stderr.contains("--portage"),
|
|
"the offer must name the explicit backends: {stderr}"
|
|
);
|
|
// Nothing may have been installed or executed.
|
|
assert!(!root
|
|
.path()
|
|
.join("var/lib/phoebus/transactions.toml")
|
|
.exists());
|
|
}
|
|
|
|
#[test]
|
|
fn please_install_enters_same_ai_workflow() {
|
|
if effective_uid_is_root() {
|
|
return;
|
|
}
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let empty = tempfile::tempdir().expect("empty PATH");
|
|
let out = sys()
|
|
.env("PATH", empty.path())
|
|
.env("PHOEBUS_AI_PROVIDER", "none")
|
|
.env("PHOEBUS_AI_BACKEND", "direct")
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["please", "install", "firefox"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("No connected model") || stderr.contains("no AI provider"),
|
|
"stderr: {stderr}"
|
|
);
|
|
assert!(
|
|
stderr.contains("--flatpak") && stderr.contains("--portage"),
|
|
"the offer must name the explicit backends: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn the_help_lists_every_backend_flag() {
|
|
let out = sys().arg("--help").output().expect("run sys");
|
|
assert!(out.status.success());
|
|
let stdout = String::from_utf8_lossy(&out.stdout);
|
|
for flag in [
|
|
"--portage",
|
|
"--flatpak",
|
|
"--nix",
|
|
"--snap",
|
|
"--appimage",
|
|
"--ebuild",
|
|
"--legacy",
|
|
"--broker",
|
|
] {
|
|
assert!(stdout.contains(flag), "help is missing {flag}");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn choose_never_invents_a_candidate() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let empty = tempfile::tempdir().expect("empty PATH");
|
|
let out = sys()
|
|
.env("PATH", empty.path())
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["choose", "some-package", "--legacy"])
|
|
.output()
|
|
.expect("run sys");
|
|
let stdout = String::from_utf8_lossy(&out.stdout);
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
if out.status.success() {
|
|
assert!(stdout.contains("Selected package:"), "stdout: {stdout}");
|
|
assert!(stdout.contains("source:"), "stdout: {stdout}");
|
|
} else {
|
|
assert!(
|
|
stderr.contains("no compatible") || stderr.contains("sys:"),
|
|
"stderr: {stderr}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn remove_without_installed_copy_fails_closed() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["remove", "nonexistent-app", "--legacy"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("is not installed") || stderr.contains("found"),
|
|
"stderr: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn remove_ambiguous_copies_requires_explicit_lane() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
// Create an AppImage record
|
|
let appimage_dir = root.path().join("var/lib/phoebus/appimages");
|
|
std::fs::create_dir_all(&appimage_dir).unwrap();
|
|
std::fs::write(
|
|
appimage_dir.join("shared-app.toml"),
|
|
"name = \"shared-app\"\nversion = \"1.0\"\nsha256 = \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\nprovenance = \"https://example.com/app\"\narch = \"x86_64\"\nsize_bytes = 100\ninstalled_unix = 0\n",
|
|
).unwrap();
|
|
|
|
// Create a Portage VDB entry
|
|
let portage_pkg_dir = root.path().join("var/db/pkg/app-misc/shared-app-1.0");
|
|
std::fs::create_dir_all(&portage_pkg_dir).unwrap();
|
|
std::fs::write(portage_pkg_dir.join("CONTENTS"), "").unwrap();
|
|
|
|
// Removal without source flag must fail indicating ambiguity
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["remove", "shared-app", "--legacy"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
stderr.contains("multiple lanes") && stderr.contains("explicitly"),
|
|
"stderr must report ambiguity: {stderr}"
|
|
);
|
|
|
|
// Disambiguating with --appimage allows targeting specifically that copy
|
|
let disambiguated = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.args(["remove", "shared-app", "--legacy", "--appimage"])
|
|
.output()
|
|
.expect("run sys");
|
|
let out_str = String::from_utf8_lossy(&disambiguated.stdout);
|
|
let err_str = String::from_utf8_lossy(&disambiguated.stderr);
|
|
assert!(
|
|
out_str.contains("Removal plan:") || err_str.contains("root"),
|
|
"stdout: {out_str}, stderr: {err_str}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn broker_execute_plan_rejects_missing_file() {
|
|
let out = sys()
|
|
.args([
|
|
"--broker",
|
|
"--execute-plan",
|
|
"/tmp/nonexistent-plan-id.json",
|
|
])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
}
|
|
|
|
#[test]
|
|
fn default_install_without_a_model_stops_and_offers_legacy() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let plans = tempfile::tempdir().expect("plans");
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.env("PHOEBUS_AI_PROVIDER", "")
|
|
.env("PHOEBUS_AI_API_KEY_FILE", "")
|
|
.env("PHOEBUS_PLANS_DIR", plans.path())
|
|
.args(["install", "firefox"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(stderr.contains("legacy"), "stderr: {stderr}");
|
|
assert!(!stderr.contains("installed firefox"), "stderr: {stderr}");
|
|
}
|
|
|
|
#[test]
|
|
fn default_removal_without_a_model_stops_and_offers_legacy() {
|
|
let root = tempfile::tempdir().expect("temp root");
|
|
let plans = tempfile::tempdir().expect("plans");
|
|
let out = sys()
|
|
.arg("--root")
|
|
.arg(root.path())
|
|
.env("PHOEBUS_AI_PROVIDER", "")
|
|
.env("PHOEBUS_AI_API_KEY_FILE", "")
|
|
.env("PHOEBUS_PLANS_DIR", plans.path())
|
|
.args(["remove", "firefox"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(stderr.contains("legacy"), "stderr: {stderr}");
|
|
}
|
|
|
|
#[test]
|
|
fn broker_execute_plan_requires_a_plan_uid() {
|
|
// Even a valid-looking id is refused without the initiating uid; the
|
|
// broker never falls back to an arbitrary path or to `/`.
|
|
let out = sys()
|
|
.args(["--broker", "--execute-plan", "plan-inst-deadbeef"])
|
|
.output()
|
|
.expect("run sys");
|
|
assert!(!out.status.success());
|
|
}
|