Skip to content

Commit

Permalink
Tang tests for Clevis config validation
Browse files Browse the repository at this point in the history
(cherry picked from commit 524efe0)
  • Loading branch information
jbaublitz authored and mulkieran committed Jun 25, 2024
1 parent 079fc11 commit 40aa9d6
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/engine/strat_engine/backstore/crypt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,4 +485,53 @@ mod tests {
test_clevis_initialize,
);
}

fn test_clevis_tang_configs(paths: &[&Path]) {
let path = paths[0];
let pool_name = Name::new("pool_name".to_string());

assert!(CryptHandle::initialize(
path,
PoolUuid::new_v4(),
DevUuid::new_v4(),
pool_name.clone(),
&EncryptionInfo::ClevisInfo((
"tang".to_string(),
json!({"url": env::var("TANG_URL").expect("TANG_URL env var required")}),
)),
None,
)
.is_err());
CryptHandle::initialize(
path,
PoolUuid::new_v4(),
DevUuid::new_v4(),
pool_name,
&EncryptionInfo::ClevisInfo((
"tang".to_string(),
json!({
"stratis:tang:trust_url": true,
"url": env::var("TANG_URL").expect("TANG_URL env var required"),
}),
)),
None,
)
.unwrap();
}

#[test]
fn clevis_real_test_clevis_tang_configs() {
real::test_with_spec(
&real::DeviceLimits::Exactly(1, None, None),
test_clevis_tang_configs,
);
}

#[test]
fn clevis_loop_test_clevis_tang_configs() {
loopbacked::test_with_spec(
&loopbacked::DeviceLimits::Exactly(1, None),
test_clevis_tang_configs,
);
}
}

0 comments on commit 40aa9d6

Please sign in to comment.