4d802a02
Exercise lease commands with abbreviated issue ids
a73x 2026-09-06 09:46
Commit message
tests/lease_cli_test.rs
| Old | New | ||
|---|---|---|---|
| @@ -50,7 +50,8 @@ fn setup(name: &str) -> (ServerHarness, String) { | |||
| 50 | fn claim_then_claims_lists_it() { | 50 | fn claim_then_claims_lists_it() { |
| 51 | let (harness, id) = setup("cli-lease-claim"); | 51 | let (harness, id) = setup("cli-lease-claim"); |
| 52 | 52 | ||
| 53 | let claim = issue_cmd(&harness, &["claim", &id, "--remote", "srv"]); | 53 | // Use the same abbreviated id that `issue list` prints. |
| 54 | let claim = issue_cmd(&harness, &["claim", &id[..8], "--remote", "srv"]); | ||
| 54 | assert!( | 55 | assert!( |
| 55 | claim.status.success(), | 56 | claim.status.success(), |
| 56 | "claim failed: {}{}", | 57 | "claim failed: {}{}", |
| @@ -132,7 +133,9 @@ fn unclaim_frees_the_issue() { | |||
| 132 | let second = harness.second_authorized_key(); | 133 | let second = harness.second_authorized_key(); |
| 133 | 134 | ||
| 134 | issue_cmd(&harness, &["claim", &id, "--ttl", "300", "--remote", "srv"]); | 135 | issue_cmd(&harness, &["claim", &id, "--ttl", "300", "--remote", "srv"]); |
| 135 | let unclaim = issue_cmd(&harness, &["unclaim", &id, "--remote", "srv"]); | 136 | // The CLI prints an abbreviation, so the other side of the pair must |
| 137 | // accept one rather than silently leaving the full-id lease held. | ||
| 138 | let unclaim = issue_cmd(&harness, &["unclaim", &id[..8], "--remote", "srv"]); | ||
| 136 | assert!( | 139 | assert!( |
| 137 | unclaim.status.success(), | 140 | unclaim.status.success(), |
| 138 | "{}{}", | 141 | "{}{}", |
| @@ -158,7 +161,10 @@ fn renew_updates_the_expiry() { | |||
| 158 | let (harness, id) = setup("cli-lease-renew"); | 161 | let (harness, id) = setup("cli-lease-renew"); |
| 159 | 162 | ||
| 160 | issue_cmd(&harness, &["claim", &id, "--ttl", "60", "--remote", "srv"]); | 163 | issue_cmd(&harness, &["claim", &id, "--ttl", "60", "--remote", "srv"]); |
| 161 | let renew = issue_cmd(&harness, &["renew", &id, "--ttl", "600", "--remote", "srv"]); | 164 | let renew = issue_cmd( |
| 165 | &harness, | ||
| 166 | &["renew", &id[..8], "--ttl", "600", "--remote", "srv"], | ||
| 167 | ); | ||
| 162 | assert!(renew.status.success(), "{}{}", out(&renew), err(&renew)); | 168 | assert!(renew.status.success(), "{}{}", out(&renew), err(&renew)); |
| 163 | assert!(out(&renew).contains("Renewed"), "{}", out(&renew)); | 169 | assert!(out(&renew).contains("Renewed"), "{}", out(&renew)); |
| 164 | } | 170 | } |