mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-24 05:52:07 +08:00
test: remove redundant backend coverage
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user