test: remove redundant backend coverage

This commit is contained in:
Tunglies
2026-08-22 08:53:42 +08:00
parent 629c00dc4a
commit 0d3f141f20
9 changed files with 5 additions and 386 deletions
-22
View File
@@ -395,19 +395,6 @@ mod tests {
})
}
#[test]
fn a_staged_runtime_is_reloaded_from_where_the_service_put_it() {
let attempt = StageAttempt::Answered(StageRuntimeOutcome::Staged {
config_path: "/service/runtime.generation-1/config.yaml".to_owned(),
});
assert_eq!(
plan_config_application(&attempt),
ConfigApplication::ReloadFrom("/service/runtime.generation-1/config.yaml".into()),
"the core must be pointed at the service's copy, never at the app's own"
);
}
/// Exhaustively maps every service rejection into the policy under test.
fn declined(reason: StageRejection) -> StageAttempt {
match &reason {
@@ -488,15 +475,6 @@ mod tests {
}
}
#[test]
fn a_request_that_never_came_back_makes_the_core_be_replaced() {
// Silence gives no trustworthy path to reload.
assert_eq!(
plan_config_application(&StageAttempt::Unanswered("connection reset".into())),
ConfigApplication::ReplaceCore
);
}
#[tokio::test]
async fn an_answer_is_taken_at_its_word_and_not_asked_for_twice() {
// Do not pay for a confirmation after a conclusive answer.
-110
View File
@@ -858,24 +858,6 @@ mod tests {
}
}
#[tokio::test]
async fn controlled_sidecar_stop_clears_proxy_before_stopping() {
let calls = Arc::new(Mutex::new(Vec::new()));
let result = run_controlled_stop_transition(
true,
RunningMode::Sidecar,
ProxyStopIntent::Clear,
|| future::ready(true),
|| transition_step(&calls, "proxy_clear", None),
|| transition_step(&calls, "core_stop", None),
)
.await;
assert!(result.is_ok());
assert_eq!(&*calls.lock(), &["proxy_clear", "core_stop"]);
}
#[test]
fn only_a_macos_sidecar_on_its_way_to_the_service_leaves_the_proxy_alone() {
use super::proxy_stop_intent;
@@ -944,24 +926,6 @@ mod tests {
}
}
#[tokio::test]
async fn a_sidecar_handed_over_still_stops_even_when_a_user_space_clear_would_fail() {
let calls = Arc::new(Mutex::new(Vec::new()));
let result = run_controlled_stop_transition(
true,
RunningMode::Sidecar,
ProxyStopIntent::HandOverToService,
|| future::ready(true),
|| transition_step(&calls, "proxy_clear", Some("proxy_clear")),
|| transition_step(&calls, "core_stop", None),
)
.await;
assert!(result.is_ok());
assert_eq!(&*calls.lock(), &["core_stop"]);
}
#[tokio::test]
async fn an_ordinary_sidecar_stop_still_clears_even_off_macos() {
for is_macos in [true, false] {
@@ -1051,46 +1015,6 @@ mod tests {
);
}
#[tokio::test]
async fn controlled_sidecar_stop_aborts_when_proxy_clear_fails() {
let calls = Arc::new(Mutex::new(Vec::new()));
let result = run_controlled_stop_transition(
true,
RunningMode::Sidecar,
ProxyStopIntent::Clear,
|| future::ready(true),
|| transition_step(&calls, "proxy_clear", Some("proxy_clear")),
|| transition_step(&calls, "core_stop", None),
)
.await;
assert!(result.is_err());
assert_eq!(&*calls.lock(), &["proxy_clear"]);
}
#[tokio::test]
async fn failed_sidecar_transition_rollback_surfaces_clear_failure_without_terminating() {
let calls = Arc::new(Mutex::new(Vec::new()));
let sidecar_alive = AtomicBool::new(true);
let result = run_sidecar_termination_transition(
|| transition_step(&calls, "rollback-proxy-clear", Some("rollback-proxy-clear")),
|| {
sidecar_alive.store(false, Ordering::Release);
calls.lock().push("rollback-sidecar-stop");
},
)
.await;
assert!(matches!(
result,
Err(error) if error.to_string().contains("rollback-proxy-clear failed")
));
assert!(sidecar_alive.load(Ordering::Acquire));
assert_eq!(&*calls.lock(), &["rollback-proxy-clear"]);
}
#[tokio::test]
async fn handoff_sidecar_cleanup_is_clear_gated_and_ordered() {
for fail_at in [None, Some("handoff-proxy-clear")] {
@@ -1236,21 +1160,6 @@ mod tests {
assert!(!restored_new_core.load(Ordering::Acquire));
}
#[tokio::test]
async fn service_config_start_failure_uses_the_same_fail_closed_replacement_order() {
let calls = Arc::new(Mutex::new(Vec::new()));
let result = run_core_replacement_transition(
|| transition_step(&calls, "controlled-stop", None),
|| transition_step(&calls, "start-service-config", Some("start-service-config")),
|| transition_step(&calls, "restore-proxy", None),
)
.await;
assert!(result.is_err());
assert_eq!(&*calls.lock(), &["controlled-stop", "start-service-config"]);
}
#[tokio::test]
async fn service_config_replacement_is_controlled_and_generation_safe_on_every_platform() {
for is_macos in [false, true] {
@@ -1404,25 +1313,6 @@ mod tests {
));
}
#[test]
fn a_sidecar_that_failed_to_start_can_be_tried_again() {
// Revoking a failed attempt's allowance keeps retries reachable without changing Service health.
for health in [
ServiceStatus::NotInstalled,
ServiceStatus::NeedsReinstall,
ServiceStatus::Unavailable("boom".into()),
] {
assert!(
can_allow_sidecar_for_session(&RunningMode::NotRunning, &health),
"{health:?} must still admit a second attempt"
);
}
assert!(!can_allow_sidecar_for_session(
&RunningMode::NotRunning,
&ServiceStatus::SidecarAllowed,
));
}
#[test]
fn proxy_restore_requires_the_same_ready_core_generation() {
let sidecar =