aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/receptor.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/receptor.rs b/tests/receptor.rs
index 56a1666..f8417a3 100644
--- a/tests/receptor.rs
+++ b/tests/receptor.rs
@@ -508,7 +508,11 @@ fn command_line() {
"--schema={}",
host.root.join("schema.json").display()
))
- .arg(format!("--systemctl={}", host.systemctl().display()))
+ .args(
+ arguments
+ .contains(&"--apply")
+ .then(|| format!("--systemctl={}", host.systemctl().display())),
+ )
.output()
.unwrap();
(
@@ -556,6 +560,17 @@ fn command_line() {
"{stdout}"
);
// Options not for the command, and two commands.
+ // Settings the command doesn't use, as arguments; from a file they are fine.
+ let (code, _, stderr) = enstate(&["--status", "--unit=x.service"]);
+ assert_eq!(code, Some(2));
+ assert!(stderr.contains("--unit is not for --status"), "{stderr}");
+ let (code, _, stderr) = enstate(&["--plan", missing, "--systemctl=/bin/true"]);
+ assert_eq!(code, Some(2));
+ assert!(stderr.contains("--systemctl is not for --plan"), "{stderr}");
+ std::fs::write(host.root.join("unit.json"), r#"{"unit": "x.service"}"#).unwrap();
+ let config = format!("--config={}", host.root.join("unit.json").display());
+ let (code, _, stderr) = enstate(&["--status", &config]);
+ assert_eq!(code, Some(0), "{stderr}");
let (code, _, stderr) = enstate(&["--status", "--out", "x"]);
assert_eq!(code, Some(2));
assert!(stderr.contains("--out is for --pack only"), "{stderr}");