prvng_platform/orchestrator/tests/test_oci_integration.rs
2025-10-07 10:59:52 +01:00

70 lines
2.0 KiB
Rust

//! OCI Integration Tests
use provisioning_orchestrator::oci::{OciManager, OciArtifact};
use std::path::PathBuf;
#[tokio::test]
async fn test_oci_manager_initialization() {
let manager = OciManager::new(
"http://localhost:5000".to_string(),
"provisioning-extensions".to_string(),
PathBuf::from("/tmp/oci-cache"),
);
assert_eq!(true, true); // Manager created successfully
}
#[tokio::test]
async fn test_oci_cache_clear() {
let manager = OciManager::new(
"http://localhost:5000".to_string(),
"provisioning-extensions".to_string(),
PathBuf::from("/tmp/oci-cache"),
);
// Clear empty cache should succeed
manager.clear_cache().await;
}
#[test]
fn test_oci_artifact_creation() {
let artifact = OciArtifact {
name: "test-package".to_string(),
version: "1.0.0".to_string(),
digest: "sha256:abcdef1234567890".to_string(),
size: 1024,
media_type: "application/vnd.oci.image.manifest.v1+json".to_string(),
created_at: chrono::Utc::now(),
};
assert_eq!(artifact.name, "test-package");
assert_eq!(artifact.version, "1.0.0");
assert_eq!(artifact.size, 1024);
assert!(artifact.digest.starts_with("sha256:"));
}
#[test]
fn test_oci_artifact_media_types() {
let manifest_type = "application/vnd.oci.image.manifest.v1+json";
let config_type = "application/vnd.oci.image.config.v1+json";
let layer_type = "application/vnd.oci.image.layer.v1.tar+gzip";
assert!(manifest_type.contains("manifest"));
assert!(config_type.contains("config"));
assert!(layer_type.contains("layer"));
}
#[tokio::test]
async fn test_cache_directory_creation() {
let cache_dir = PathBuf::from("/tmp/oci-cache-test");
let manager = OciManager::new(
"http://localhost:5000".to_string(),
"provisioning-extensions".to_string(),
cache_dir.clone(),
);
// Manager should handle cache directory
assert_eq!(true, true);
}