Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
test(ci): resolve cross-platform asset resolution and Windows update assertions
Samir Hossains61d6825cf005
diff --git a/tests/update_lifecycle.rs b/tests/update_lifecycle.rsindex 3392ce8..15917e2 100644--- a/tests/update_lifecycle.rs+++ b/tests/update_lifecycle.rs@@ -331,12 +331,14 @@ fn test_environment_detection() {InstallationEnvironment::DirectReplace| InstallationEnvironment::Homebrew| InstallationEnvironment::ReadOnly+ | InstallationEnvironment::WindowsHelper));let writable = is_writable(¤t_exe);assert!(writable|| env == InstallationEnvironment::ReadOnly|| env == InstallationEnvironment::Homebrew+ || env == InstallationEnvironment::WindowsHelper);}@@ -350,7 +352,9 @@ fn test_binary_replacement_and_rollback_on_failure() {std::fs::write(&staged_exe, b"new v2").unwrap();let outcome = apply_staged_binary(&staged_exe, ¤t_exe).unwrap();- if outcome == SelfUpdateOutcome::Success {+ assert_eq!(outcome, SelfUpdateOutcome::Success);+ #[cfg(unix)]+ {assert_eq!(std::fs::read(¤t_exe).unwrap(), b"new v2");}}diff --git a/tests/version_upgrade_e2e.rs b/tests/version_upgrade_e2e.rsindex 849dae6..9f1c30d 100644--- a/tests/version_upgrade_e2e.rs+++ b/tests/version_upgrade_e2e.rs@@ -123,21 +123,21 @@ async fn test_genuine_end_to_end_version_upgrade_0_1_12_to_0_1_13() {let v0_1_13_binary_source = temp_dir.path().join("moviebox_v0_1_13_source");create_versioned_mock_executable(&v0_1_13_binary_source, "0.1.13");- let v0_1_13_archive = temp_dir.path().join("MovieBox_macOS_Universal.tar.gz");+ let target_platform = TargetPlatform::current().unwrap();+ let asset_name = target_platform.expected_asset_name();++ let v0_1_13_archive = temp_dir.path().join(asset_name);package_mock_archive(&v0_1_13_binary_source, &v0_1_13_archive);let archive_bytes = std::fs::read(&v0_1_13_archive).unwrap();let archive_sha256 = compute_sha256(&v0_1_13_archive).unwrap();- let checksum_content = format!("{} MovieBox_macOS_Universal.tar.gz\n", archive_sha256);+ let checksum_content = format!("{} {}\n", archive_sha256, asset_name);let checksum_bytes = checksum_content.as_bytes().to_vec();let shutdown_notify = Arc::new(Notify::new());let port =spawn_mock_release_server(archive_bytes, checksum_bytes, shutdown_notify.clone()).await;- let target_platform = TargetPlatform::current().unwrap();- let asset_name = target_platform.expected_asset_name();-let release = Release {version: "0.1.13".to_string(),tag_name: "v0.1.13".to_string(),@@ -223,9 +223,12 @@ async fn test_corrupted_upgrade_artifact_leaves_current_version_intact() {"moviebox-tui 0.1.12");+ let target_platform = TargetPlatform::current().unwrap();+ let asset_name = target_platform.expected_asset_name();+let corrupted_archive_bytes = b"CORRUPTED BYTES IN TRANSIT".to_vec();let valid_checksum = "43b226c381c1644e5d62ed3e40e8da0a8fb270f297ddefe31b337b9992851e6a";- let checksum_content = format!("{} MovieBox_macOS_Universal.tar.gz\n", valid_checksum);+ let checksum_content = format!("{} {}\n", valid_checksum, asset_name);let checksum_bytes = checksum_content.as_bytes().to_vec();let shutdown_notify = Arc::new(Notify::new());@@ -236,9 +239,6 @@ async fn test_corrupted_upgrade_artifact_leaves_current_version_intact() {).await;- let target_platform = TargetPlatform::current().unwrap();- let asset_name = target_platform.expected_asset_name();-let downloaded_archive = temp_dir.path().join("downloaded_corrupted.tar.gz");download_file(&format!("http://127.0.0.1:{}/{}", port, asset_name),