Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions revoke-test/tests/system_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@ fn real_world_system_tests() {
.unwrap();
fs::write(TEST_CONFIG_PATH, TEST_CONFIG).unwrap();

upki()
let fetch = upki()
.arg("--config-file")
.arg(TEST_CONFIG_PATH)
.arg("fetch")
.output()
.expect("cannot execute 'upki fetch'");
assert!(
fetch.status.success(),
"'upki fetch' failed ({})\nstdout:\n{}\nstderr:\n{}",
fetch.status,
String::from_utf8_lossy(&fetch.stdout),
String::from_utf8_lossy(&fetch.stderr),
);

let tests = serde_json::from_reader::<_, RevocationTestSites<'static>>(
File::open("../revoke-test/test-sites.json")
Expand Down Expand Up @@ -82,8 +89,11 @@ fn real_world_system_tests() {
#[cfg(not(windows))]
let ((((site, high), rustls), ffi), openssl) = cases;

// When rustls reports the cert as expired it short-circuits before doing any revocation
// check, so its verdict says nothing about revocation status. The high-level API does no
// expiry check, so the two are not comparable in that case; skip the comparison.
assert!(
high == rustls || *high == rustls.expired_as_revoked(),
high == rustls || *rustls == TestResult::Expired,
"site {site:?} revocation result disagrees between high-level API ({high:?}) and rustls verifier ({rustls:?})"
);
assert!(
Expand Down Expand Up @@ -271,18 +281,6 @@ enum TestResult {
Expired,
}

impl TestResult {
fn expired_as_revoked(&self) -> Self {
// The high-level CLI doesn't do expiry checks, while the rustls verifier does.
// So we treat expiry as a class of revocation for the purpose of checking
// that the APIs agree.
match self {
Self::Expired => Self::CorrectlyRevoked,
other => *other,
}
}
}

const TEST_CONFIG_PATH: &str = "tmp/system-test/config.toml";
const TEST_CONFIG: &str = "cache-dir=\"tmp/system-test\"\n\
[revocation]\n\
Expand Down
Loading