use detee_shared::sgx::types::dtpm::{compress_directory, decompress_directory, DtpmConfig}; use std::sync::LazyLock; static TEMP_DIR: LazyLock = LazyLock::new(|| { tempfile::tempdir() .unwrap() .into_path() .to_string_lossy() .to_string() }); #[test] fn dtpm_config_dir_support_test() { let file_path = "tests/fixtures/dtpm_config.yaml"; let unloaded_config = DtpmConfig::from_path(file_path).unwrap(); let loaded_config = unloaded_config.load_data().unwrap(); dbg!(&loaded_config); } #[test] fn test_compression() { let file_path = "./tests"; let compressed_buff = compress_directory(file_path).unwrap(); dbg!(&TEMP_DIR); std::fs::write( format!("{}/{}", *TEMP_DIR, "archive.tar.zst"), &compressed_buff, ) .unwrap(); } #[test] fn test_decompression_02() { let file_path = "./tests"; let archive_buff = compress_directory(file_path).unwrap(); decompress_directory(&TEMP_DIR, archive_buff).unwrap(); let path = format!("{}/{}", *TEMP_DIR, "tests/fixtures/dtpm_config.yaml"); assert!(std::path::Path::new(&path).exists()); }