#![cfg(feature = "vms")]
use foundation_deployment_platform::config::GuestOs;
#[test]
fn test_auto_detect_search_paths() {
let target = foundation_deployment_platform::build::target_triple(GuestOs::Linux);
assert!(target.contains("aarch64"));
}
#[test]
fn test_log_kind_from_str() {
use foundation_deployment_platform::runner::logs::LogKind;
assert!("build".parse::<LogKind>().is_ok());
assert!("run".parse::<LogKind>().is_ok());
assert!("invalid".parse::<LogKind>().is_err());
}
#[test]
fn test_log_path_linux() {
use foundation_deployment_platform::config::get_profile;
use foundation_deployment_platform::runner::logs::{log_path, LogKind};
let profile = get_profile("linux-build").unwrap().clone();
assert_eq!(
log_path(&profile, LogKind::Build),
"/home/vagrant/.testbed-build/build.log"
);
}
#[test]
fn test_log_path_windows() {
use foundation_deployment_platform::config::get_profile;
use foundation_deployment_platform::runner::logs::{log_path, LogKind};
let profile = get_profile("windows-build").unwrap().clone();
assert!(log_path(&profile, LogKind::Build).contains("Users"));
assert!(log_path(&profile, LogKind::Build).contains("build.log"));
}
#[test]
fn test_capture_uses_correct_paths() {
let path = "/tmp/testbed-screenshot.png";
assert!(path.starts_with("/tmp/"));
assert!(path.ends_with(".png"));
}
#[test]
fn test_push_identifies_directory() {
let temp = std::env::temp_dir().join("test_push_dir");
let _ = std::fs::create_dir_all(&temp);
assert!(temp.is_dir());
let _ = std::fs::remove_dir_all(&temp);
}
#[test]
fn test_push_uses_upload_for_files() {
use std::path::PathBuf;
let local = PathBuf::from("/tmp/test.txt");
let remote = "/tmp/test.txt";
assert_eq!(local.is_file(), false); assert_eq!(remote, "/tmp/test.txt");
}
#[test]
fn test_linux_type_escape() {
let text = "hello 'world'";
let escaped = text.replace("\\", "\\\\").replace("'", "\\'");
assert_eq!(escaped, "hello \\'world\\'");
}
#[test]
fn test_windows_type_escape() {
let text = "hello+world^test%foo";
let escaped = text
.replace("+", "{{+}}")
.replace("^", "{{^}}")
.replace("%", "{{%}}")
.replace("~", "{{~}}");
assert_eq!(escaped, "hello{{+}}world{{^}}test{{%}}foo");
}
#[test]
fn test_validation_result_structure() {
use foundation_deployment_platform::runner::validate::ValidationResult;
let result = ValidationResult {
match_pct: 95.0,
passed: true,
diff_path: None,
};
assert!(result.passed);
assert!((result.match_pct - 95.0).abs() < 0.01);
}
#[test]
fn test_default_tolerance_95_percent() {
let tolerance = 95.0;
assert!(96.0 >= tolerance);
assert!(94.0 < tolerance);
}