diff options
| author | Namilskyy <alive6863@gmail.com> | 2025-12-03 21:00:31 +0300 |
|---|---|---|
| committer | Namilskyy <alive6863@gmail.com> | 2025-12-03 21:00:31 +0300 |
| commit | 2c8b804cd61a480501069cdf4d4377f3c2cf30bb (patch) | |
| tree | 2eecc7396b2445d881c316848f158830aa6a8d7d /tests | |
| parent | 2c7b2b72edf32ec19ac9b72b47c075209717deb4 (diff) | |
Not much of the documentation has been implemented, as well as some minor changes
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/pkgtoolkit_funcs.rs | 13 | ||||
| -rw-r--r-- | tests/shared.rs | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/pkgtoolkit_funcs.rs b/tests/pkgtoolkit_funcs.rs index 4e7f877..9e92e21 100644 --- a/tests/pkgtoolkit_funcs.rs +++ b/tests/pkgtoolkit_funcs.rs @@ -4,8 +4,8 @@ use mesk::pkgtoolkit::pkgtools::{Archs, Package}; mod shared; use shared::create_test_config; +use serial_test::serial; use tempfile::TempDir; -use tokio; // Pkg toolkit tests #[cfg(test)] @@ -15,6 +15,7 @@ mod package_tests { use std::io::Write; #[test] + #[serial] fn test_archs_as_str() { assert_eq!(Archs::X86_64.as_str(), "x86_64"); assert_eq!(Archs::Aarch64.as_str(), "aarch64"); @@ -24,6 +25,7 @@ mod package_tests { } #[tokio::test] + #[serial] async fn test_extract_archive() { let temp_dir = TempDir::new().unwrap(); let _config = create_test_config(temp_dir.path().to_str().unwrap()); @@ -51,7 +53,6 @@ mod package_tests { assert_eq!(content, test_file_content); } Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => { - // допустимый исход для запуска без root return; } Err(e) => panic!("unexpected error in extract_archive: {e}"), @@ -59,6 +60,7 @@ mod package_tests { } #[tokio::test] + #[serial] async fn test_package_check_valid() { let temp_dir = TempDir::new().unwrap(); let _config = create_test_config(temp_dir.path().to_str().unwrap()); @@ -105,8 +107,10 @@ mode = "755" } #[tokio::test] + #[serial] async fn test_package_check_missing_install() { let temp_dir = TempDir::new().unwrap(); + let _config = create_test_config(temp_dir.path().to_str().unwrap()); let archive_path = temp_dir.path().join("test_pkg_without_install.tar.gz"); let file = fs::File::create(&archive_path).unwrap(); @@ -126,7 +130,6 @@ mode = "755" panic!("expected error, got Ok"); } Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => { - // допустимый исход для запуска без root return; } Err(err) => { @@ -137,8 +140,10 @@ mode = "755" } #[tokio::test] + #[serial] async fn test_package_check_empty_install() { let temp_dir = TempDir::new().unwrap(); + let _config = create_test_config(temp_dir.path().to_str().unwrap()); let install_path = temp_dir.path().join("INSTALL"); fs::write(&install_path, "").unwrap(); @@ -158,7 +163,6 @@ mode = "755" panic!("expected error, got Ok"); } Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => { - // допустимый исход для запуска без root return; } Err(err) => { @@ -169,6 +173,7 @@ mode = "755" } #[tokio::test] + #[serial] async fn test_package_check_arch_mismatch() { let temp_dir = TempDir::new().unwrap(); let _config = create_test_config(temp_dir.path().to_str().unwrap()); diff --git a/tests/shared.rs b/tests/shared.rs index 9a192c1..574e8cd 100644 --- a/tests/shared.rs +++ b/tests/shared.rs @@ -16,6 +16,7 @@ pub fn create_test_config(temp_dir_path: &str) -> Config { paths: Paths { cache_dir: String::from(temp_dir_path), build_dir: String::from(format!("{}/build", String::from(temp_dir_path))), + installed_db: String::from(format!("{}/pkgdb", String::from(temp_dir_path))), }, }; |
