-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun_integration.rs
More file actions
62 lines (58 loc) · 1.9 KB
/
Copy pathrun_integration.rs
File metadata and controls
62 lines (58 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Integration tests for `ado-aw run`.
use std::path::PathBuf;
fn binary() -> PathBuf {
PathBuf::from(env!("CARGO_BIN_EXE_ado-aw"))
}
#[test]
fn run_help_describes_command() {
let output = std::process::Command::new(binary())
.args(["run", "--help"])
.output()
.expect("Failed to run ado-aw run --help");
assert!(output.status.success(), "--help should exit 0");
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
stdout.contains("Queue a build"),
"Help text should describe the run command, got:\n{stdout}"
);
for flag in [
"--org",
"--project",
"--pat",
"--branch",
"--parameters",
"--wait",
"--poll-interval",
"--timeout",
"--dry-run",
] {
assert!(
stdout.contains(flag),
"Expected --help to advertise {flag}, got:\n{stdout}"
);
}
// The comma-in-value constraint is surfaced in `--help` so users
// can self-diagnose without consulting the module doc-comment.
assert!(
stdout.contains("VALUES MUST NOT CONTAIN COMMAS")
|| stdout.contains("must not contain commas"),
"Expected --help to advertise the no-commas-in-values constraint, got:\n{stdout}"
);
}
#[test]
fn run_rejects_poll_interval_without_wait() {
// clap should reject `--poll-interval` (and `--timeout`) when `--wait` is absent.
let output = std::process::Command::new(binary())
.args(["run", "--poll-interval", "5"])
.output()
.expect("Failed to run ado-aw run");
assert!(
!output.status.success(),
"Expected non-zero exit when --poll-interval used without --wait"
);
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.contains("--wait"),
"stderr should reference '--wait' as the missing required argument, got:\n{stderr}"
);
}