mirror of
https://github.com/storytold/craft-launcher.git
synced 2026-12-02 20:22:35 -05:00
Run the Nightly staging tests only where Nightly installs are staged (#1610)
* Run the Nightly staging tests only where Nightly installs are staged On FreeBSD, which has no Nightly adapter, twelve transaction review tests and one selection test stop at "No nightly isolation contract is staged for this Unix platform", and the exclusive-move test sees move_to refuse before any rename (exclusive moves exist only on Linux, macOS and Windows). Gate them to Linux and macOS, matching the Nightly capability rows. * Word the selection test gate comment for any platform * Keep the Nightly staging tests on Windows too The previous gate limited them to Linux and macOS, which also dropped them on Windows, where Nightly installs are staged, and left their helpers unused there (clippy -D warnings). Gate them to Linux, macOS and Windows, matching the Nightly adapters, and allow the now-unused helpers only on other platforms such as FreeBSD. * Assert that Nightly moves and staging refuse where they are not supported On FreeBSD and other Unix systems the gated success-path tests are skipped, so check the actual behaviour there instead: an exclusive move refuses and leaves the source in place, and the isolation check refuses before any install.
This commit is contained in:
1 parent
014ac5b85b
commit
c4a20f6c83
3 files changed
+46
-1
No files matched your search
@@ -1,3 +1,4 @@
|
||||
#![cfg_attr(not(any(target_os = "linux", target_os = "macos", target_os = "windows")), allow(dead_code))] // Helpers for tests that run only where Nightly installs are staged.
|
||||
use super::*;
|
||||
use crate::nightly_lookup::{self, Outcome};
|
||||
|
||||
@@ -19,6 +20,7 @@ fn complete(shared: &Shared, paths: &Paths, platform: Platform, run: u64) {
|
||||
finish_nightly_result(app(), platform, 0, Outcome::Verified(Box::new(nightly_lookup::tests::verified(run))), shared, paths);
|
||||
shared.nightly_state.lock().unwrap().finish();
|
||||
}
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // A Nightly install plan is staged only there.
|
||||
#[test]
|
||||
fn selection_ui_and_install_gate_agree_and_failed_refresh_retains_stale_success() {
|
||||
let (_temp, shared, paths, platform) = fixture();
|
||||
|
||||
@@ -473,7 +473,9 @@ fn review_after_exclusive_move() {
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(all(test, unix))]
|
||||
// Exclusive moves exist only where Nightly installs are staged; elsewhere move_to refuses
|
||||
// before renaming anything, which this success-path test can't observe.
|
||||
#[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
|
||||
mod move_identity_tests {
|
||||
use super::*;
|
||||
|
||||
@@ -498,3 +500,31 @@ mod move_identity_tests {
|
||||
assert_eq!(std::fs::read(root.join("moved aside")).unwrap(), b"owned bytes");
|
||||
}
|
||||
}
|
||||
|
||||
// Where exclusive moves and Nightly staging don't exist (FreeBSD and other Unix systems), both
|
||||
// refuse cleanly: nothing is renamed, and the isolation check stops before any install.
|
||||
#[cfg(all(test, unix, not(any(target_os = "linux", target_os = "macos"))))]
|
||||
mod unsupported_platform_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn move_to_refuses_and_leaves_the_source_in_place() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let root = temp.path().canonicalize().unwrap();
|
||||
std::fs::write(root.join("owned"), b"owned bytes").unwrap();
|
||||
let dir = Dir::open(&root).unwrap();
|
||||
let expected = dir.info(Path::new("owned")).unwrap().unwrap().0;
|
||||
let error = dir.move_to(Path::new("owned"), &dir, Path::new("destination"), &expected).unwrap_err();
|
||||
assert_eq!(error, "Exclusive Nightly moves are unavailable on this platform.");
|
||||
assert_eq!(std::fs::read(root.join("owned")).unwrap(), b"owned bytes");
|
||||
assert!(!root.join("destination").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nightly_staging_refuses_on_this_platform() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let paths =
|
||||
crate::paths::Paths::under(&temp.path().canonicalize().unwrap()).for_channel(artcraft_launcher_core::nightly::InstallChannel::Nightly);
|
||||
assert_eq!(crate::nightly_unix::validate_namespaces(&paths).unwrap_err(), "No nightly isolation contract is staged for this Unix platform.");
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Source-owned nonexecuted mechanics fixtures and injected returned-I/O errors, not ENOSPC or power loss.
|
||||
#![cfg_attr(not(any(target_os = "linux", target_os = "macos", target_os = "windows")), allow(dead_code))] // Helpers for tests that run only where Nightly installs are staged.
|
||||
#![allow(clippy::unwrap_used)] // Test fixture setup/assertions only; production policy is unchanged.
|
||||
use super::*;
|
||||
use artcraft_launcher_core::PackageKind;
|
||||
@@ -137,6 +138,7 @@ fn retry(lease: &Lease, record: &Record) {
|
||||
assert_eq!(std::fs::read(adapter().profile_root(&lease.paths).unwrap().join("preferences")).unwrap(), b"profile bytes");
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_returned_metadata_error_preserves_sealed_plan_and_retry() {
|
||||
const TEST: &str = "review_returned_metadata_error_preserves_sealed_plan_and_retry";
|
||||
@@ -174,6 +176,7 @@ fn review_returned_metadata_error_preserves_sealed_plan_and_retry() {
|
||||
assert!(outcomes.iter().all(|outcome| outcome.ends_with("None")), "returned metadata append must reconcile and allow retry: {outcomes:?}");
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_returned_plan_error_cannot_publish_clean_with_the_wrong_phase() {
|
||||
const TEST: &str = "review_returned_plan_error_cannot_publish_clean_with_the_wrong_phase";
|
||||
@@ -243,6 +246,7 @@ fn review_returned_plan_error_cannot_publish_clean_with_the_wrong_phase() {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_live_created_node_admission_and_registration_failures_do_not_orphan_the_slot() {
|
||||
const TEST: &str = "review_live_created_node_admission_and_registration_failures_do_not_orphan_the_slot";
|
||||
@@ -283,6 +287,7 @@ fn review_live_created_node_admission_and_registration_failures_do_not_orphan_th
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_registration_failure_preserves_unknown_arrivals_without_adopting_them() {
|
||||
const TEST: &str = "review_registration_failure_preserves_unknown_arrivals_without_adopting_them";
|
||||
@@ -310,6 +315,7 @@ fn review_registration_failure_preserves_unknown_arrivals_without_adopting_them(
|
||||
assert!(diagnostic.contains("preserved"));
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_plan_and_metadata_admission_reserve_terminal_clean_inside_the_same_bound() {
|
||||
const TEST: &str = "review_plan_and_metadata_admission_reserve_terminal_clean_inside_the_same_bound";
|
||||
@@ -362,6 +368,7 @@ fn review_plan_and_metadata_admission_reserve_terminal_clean_inside_the_same_bou
|
||||
assert!(outcomes.iter().all(|outcome| outcome.contains("accepted=false")), "nonterminal admission must preserve Clean room: {outcomes:?}");
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_unknown_truncated_restart_journal_remains_unmodified_and_unadopted() {
|
||||
const TEST: &str = "review_unknown_truncated_restart_journal_remains_unmodified_and_unadopted";
|
||||
@@ -382,6 +389,7 @@ fn review_unknown_truncated_restart_journal_remains_unmodified_and_unadopted() {
|
||||
kept(&paths, &record);
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_unreconciled_live_append_cannot_retire_or_rephase_its_journal() {
|
||||
const TEST: &str = "review_unreconciled_live_append_cannot_retire_or_rephase_its_journal";
|
||||
@@ -421,6 +429,7 @@ fn review_unreconciled_live_append_cannot_retire_or_rephase_its_journal() {
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_test_owned_alias_root_is_resolved_but_production_alias_is_refused() {
|
||||
const TEST: &str = "review_test_owned_alias_root_is_resolved_but_production_alias_is_refused";
|
||||
@@ -512,6 +521,7 @@ fn barrier_removed(paths: &Paths, record: &Record) {
|
||||
assert_eq!(std::fs::read(adapter().profile_root(paths).unwrap().join("preferences")).unwrap(), b"profile bytes");
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_manifest_directory_barrier_preserves_live_backups_until_successful_retry() {
|
||||
const TEST: &str = "review_manifest_directory_barrier_preserves_live_backups_until_successful_retry";
|
||||
@@ -535,6 +545,7 @@ fn review_manifest_directory_barrier_preserves_live_backups_until_successful_ret
|
||||
eprintln!("live barrier retry succeeded; sealed journal/backups retired only after successful sync");
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_manifest_directory_barrier_preserves_fresh_lease_backups_until_successful_retry() {
|
||||
const TEST: &str = "review_manifest_directory_barrier_preserves_fresh_lease_backups_until_successful_retry";
|
||||
@@ -560,6 +571,7 @@ fn review_manifest_directory_barrier_preserves_fresh_lease_backups_until_success
|
||||
eprintln!("fresh-lease barrier retry succeeded; sealed journal/backups retired only after successful sync");
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn review_manifest_directory_barrier_preserves_ordinary_success_and_rollback() {
|
||||
const TEST: &str = "review_manifest_directory_barrier_preserves_ordinary_success_and_rollback";
|
||||
@@ -676,6 +688,7 @@ fn review_lock_guard_retirement_releases_mutation_and_manifest_with_retained_des
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] // Nightly installs are staged only there.
|
||||
#[test]
|
||||
fn an_empty_journal_left_before_its_header_does_not_lock_out_later_leases() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
|
||||
Reference in new issue
Block a user