Skip to content

Commit

Permalink
SSS tests for Clevis config validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaublitz committed Jun 18, 2024
1 parent 8a838b0 commit e1957ab
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/engine/strat_engine/backstore/crypt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,57 @@ mod tests {
test_clevis_tang_configs,
);
}

fn test_clevis_sss_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((
"sss".to_string(),
json!({"t": 1, "pins": {"tang": {"url": env::var("TANG_URL").expect("TANG_URL env var required")}, "tpm2": {}}}),
)),
None,
)
.is_err());
CryptHandle::initialize(
path,
PoolUuid::new_v4(),
DevUuid::new_v4(),
pool_name,
&EncryptionInfo::ClevisInfo((
"sss".to_string(),
json!({
"t": 1,
"stratis:tang:trust_url": true,
"pins": {
"tang": {"url": env::var("TANG_URL").expect("TANG_URL env var required")},
"tpm2": {}
}
}),
)),
None,
)
.unwrap();
}

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

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

0 comments on commit e1957ab

Please sign in to comment.