Skip to content

Commit

Permalink
rvps: fixup KBS and AS tests for new RVPS config
Browse files Browse the repository at this point in the history
We can just use the default config for most of the tests.

Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
  • Loading branch information
fitzthum committed Dec 16, 2024
1 parent 72e23a4 commit f3e2105
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
17 changes: 6 additions & 11 deletions attestation-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,22 @@ impl TryFrom<&Path> for Config {

#[cfg(test)]
mod tests {
use std::path::PathBuf;

use rstest::rstest;
use serde_json::json;
use std::path::PathBuf;

use super::Config;
use crate::rvps::RvpsCrateConfig;
use crate::{
rvps::RvpsConfig,
token::{ear_broker, simple, AttestationTokenConfig},
};
use reference_value_provider_service::storage::{local_fs, ReferenceValueStorageConfig};

#[rstest]
#[case("./tests/configs/example1.json", Config {
work_dir: PathBuf::from("/var/lib/attestation-service/"),
rvps_config: RvpsConfig::BuiltIn(RvpsCrateConfig {
store_type: "LocalFs".into(),
store_config: json!({}),
storage: ReferenceValueStorageConfig::LocalFs(local_fs::Config::default()),
}),
attestation_token_broker: AttestationTokenConfig::Simple(simple::Configuration {
duration_min: 5,
Expand All @@ -105,8 +103,7 @@ mod tests {
#[case("./tests/configs/example2.json", Config {
work_dir: PathBuf::from("/var/lib/attestation-service/"),
rvps_config: RvpsConfig::BuiltIn(RvpsCrateConfig {
store_type: "LocalFs".into(),
store_config: json!({}),
storage: ReferenceValueStorageConfig::LocalFs(local_fs::Config::default()),
}),
attestation_token_broker: AttestationTokenConfig::Simple(simple::Configuration {
duration_min: 5,
Expand All @@ -122,8 +119,7 @@ mod tests {
#[case("./tests/configs/example3.json", Config {
work_dir: PathBuf::from("/var/lib/attestation-service/"),
rvps_config: RvpsConfig::BuiltIn(RvpsCrateConfig {
store_type: "LocalFs".into(),
store_config: json!({}),
storage: ReferenceValueStorageConfig::LocalFs(local_fs::Config::default()),
}),
attestation_token_broker: AttestationTokenConfig::Ear(ear_broker::Configuration {
duration_min: 5,
Expand All @@ -138,8 +134,7 @@ mod tests {
#[case("./tests/configs/example4.json", Config {
work_dir: PathBuf::from("/var/lib/attestation-service/"),
rvps_config: RvpsConfig::BuiltIn(RvpsCrateConfig {
store_type: "LocalFs".into(),
store_config: json!({}),
storage: ReferenceValueStorageConfig::LocalFs(local_fs::Config::default()),
}),
attestation_token_broker: AttestationTokenConfig::Ear(ear_broker::Configuration {
duration_min: 5,
Expand Down
11 changes: 2 additions & 9 deletions kbs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ mod tests {
};

use rstest::rstest;
use serde_json::json;

#[rstest]
#[case("test_data/configs/coco-as-grpc-1.toml", KbsConfig {
Expand Down Expand Up @@ -293,10 +292,7 @@ mod tests {
crate::attestation::config::AttestationServiceConfig::CoCoASBuiltIn(
attestation_service::config::Config {
work_dir: "/opt/confidential-containers/attestation-service".into(),
rvps_config: RvpsConfig::BuiltIn(RvpsCrateConfig {
store_type: "LocalFs".into(),
store_config: json!({}),
}),
rvps_config: RvpsConfig::BuiltIn(RvpsCrateConfig::default()),
attestation_token_broker: AttestationTokenConfig::Simple(simple::Configuration{
duration_min: 5,
..Default::default()
Expand Down Expand Up @@ -423,10 +419,7 @@ mod tests {
crate::attestation::config::AttestationServiceConfig::CoCoASBuiltIn(
attestation_service::config::Config {
work_dir: "/opt/confidential-containers/attestation-service".into(),
rvps_config: RvpsConfig::BuiltIn(RvpsCrateConfig {
store_type: "LocalFs".into(),
..Default::default()
}),
rvps_config: RvpsConfig::BuiltIn(RvpsCrateConfig::default()),
attestation_token_broker: AttestationTokenConfig::Simple(simple::Configuration {
duration_min: 5,
policy_dir: "/opt/confidential-containers/attestation-service/simple-policies".into(),
Expand Down

0 comments on commit f3e2105

Please sign in to comment.