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
+1 -54
View File
@@ -573,7 +573,7 @@ mod tests {
use parking_lot::Mutex;
use std::sync::{
Arc,
atomic::{AtomicBool, AtomicU64, Ordering},
atomic::{AtomicBool, Ordering},
};
use std::task::Poll;
use tokio::sync::Barrier;
@@ -609,16 +609,6 @@ mod tests {
);
}
#[test]
fn stale_periodic_refresh_stops_after_owner_loss() {
let generation = AtomicU64::new(7);
let captured_generation = generation.load(Ordering::Acquire);
assert!(guard_generation_is_current(&generation, captured_generation));
generation.fetch_add(1, Ordering::AcqRel);
assert!(!guard_generation_is_current(&generation, captured_generation));
}
#[tokio::test]
async fn final_service_mutation_finishes_after_in_flight_guard_request() {
let operations = Arc::new(ServiceProxyOperations::new());
@@ -786,15 +776,6 @@ mod tests {
assert!(refreshed.is_err());
}
#[tokio::test]
async fn a_replaced_guard_does_not_get_to_report_its_last_failure() {
let operations = ServiceProxyOperations::new();
let generation = operations.invalidate_guard();
operations.invalidate_guard();
assert!(!operations.record_if_current(generation, || true).await);
}
#[tokio::test]
async fn a_report_waiting_on_the_lock_says_nothing_if_it_is_invalidated_meanwhile() {
// The generation check must happen after acquiring the operation lock.
@@ -920,32 +901,6 @@ mod tests {
wrapped_privilege_failure().context(SysproxyFailure::PrivilegeRequired)
}
#[test]
fn a_classification_survives_the_anyhow_layers_above_it() {
let classified = classified_privilege_failure()
.context("failed to apply system proxy after start")
.context("failed to restart the core");
assert_eq!(
SysproxyFailure::from_chain(&classified).map(SysproxyFailure::code),
Some("SYSPROXY_PRIVILEGE_REQUIRED")
);
}
#[test]
fn classifying_keeps_the_original_failure_underneath() {
let classified = classified_privilege_failure();
assert!(
classified.chain().any(|cause| matches!(
cause.downcast_ref::<sysproxy::Error>(),
Some(sysproxy::Error::RequiresAdminPrivileges)
)),
"the original error must survive classification: {classified:#}"
);
assert!(format!("{classified:#}").contains("failed to apply the system proxy"));
}
#[test]
fn an_unrelated_failure_is_left_alone() {
let untouched = classify_local_failure(anyhow::anyhow!("port already in use"));
@@ -1097,14 +1052,6 @@ mod tests {
));
}
#[test]
fn a_failure_that_can_be_explained_is_filed_here_as_a_restore() {
assert!(matches!(
super::table_effect(&Err(mappable()), true),
super::TableEffect::File(FailedOperation::SystemProxyRestore, _)
));
}
#[tokio::test]
async fn a_failure_is_filed_as_whatever_the_caller_declared() {
let (applied, cleared) = super::notification::asking_for(FailedOperation::SystemProxyEnable, async {