refactor: use relative heal test compat consumers (#3733)

This commit is contained in:
安正超
2026-06-22 14:55:12 +08:00
committed by GitHub
parent a3202eb6bb
commit 7d81183cf1
9 changed files with 55 additions and 20 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
use thiserror::Error;
use crate::heal::storage_compat::{DiskError, EcstoreError};
use super::heal::storage_compat::{DiskError, EcstoreError};
/// Custom error type for heal operations
/// This enum defines various error variants that can occur during
+1 -1
View File
@@ -494,10 +494,10 @@ impl HealChannelProcessor {
#[cfg(test)]
mod tests {
use super::super::storage_compat::{DiskStore, Endpoint};
use super::*;
use crate::heal::manager::HealConfig;
use crate::heal::storage::{HealObjectInfo, HealStorageAPI};
use crate::heal::storage_compat::{DiskStore, Endpoint};
use rustfs_common::heal_channel::{
HealAdmissionResult, HealChannelPriority, HealChannelRequest, HealRequestSource, HealScanMode,
};
+1 -1
View File
@@ -16,7 +16,7 @@
mod common;
use crate::common::storage_compat::{ECStore, Endpoint, EndpointServerPools, Endpoints, PoolEndpoints, init_local_disks};
use common::storage_compat::{ECStore, Endpoint, EndpointServerPools, Endpoints, PoolEndpoints, init_local_disks};
use std::net::SocketAddr;
use tempfile::TempDir;
use tokio_util::sync::CancellationToken;
+8 -8
View File
@@ -22,7 +22,7 @@ use rustfs_heal::heal::{
#[test]
fn test_heal_event_to_heal_request_no_panic() {
use crate::common::storage_compat::Endpoint;
use common::storage_compat::Endpoint;
// Test that invalid pool/set indices don't cause panic
// Create endpoint using try_from or similar method
@@ -47,7 +47,7 @@ fn test_heal_event_to_heal_request_no_panic() {
#[test]
fn test_heal_event_to_heal_request_valid_indices() {
use crate::common::storage_compat::Endpoint;
use common::storage_compat::Endpoint;
// Test that valid indices work correctly
let endpoint_result = Endpoint::try_from("http://localhost:9000");
@@ -192,11 +192,11 @@ fn test_heal_task_status_atomic_update() {
}
async fn get_disk_status(
&self,
_endpoint: &crate::common::storage_compat::Endpoint,
_endpoint: &common::storage_compat::Endpoint,
) -> rustfs_heal::Result<rustfs_heal::heal::storage::DiskStatus> {
Ok(rustfs_heal::heal::storage::DiskStatus::Ok)
}
async fn format_disk(&self, _endpoint: &crate::common::storage_compat::Endpoint) -> rustfs_heal::Result<()> {
async fn format_disk(&self, _endpoint: &common::storage_compat::Endpoint) -> rustfs_heal::Result<()> {
Ok(())
}
async fn get_bucket_info(&self, _bucket: &str) -> rustfs_heal::Result<Option<rustfs_storage_api::BucketInfo>> {
@@ -250,7 +250,7 @@ fn test_heal_task_status_atomic_update() {
) -> rustfs_heal::Result<(Vec<String>, Option<String>, bool)> {
Ok((vec![], None, false))
}
async fn get_disk_for_resume(&self, _set_disk_id: &str) -> rustfs_heal::Result<crate::common::storage_compat::DiskStore> {
async fn get_disk_for_resume(&self, _set_disk_id: &str) -> rustfs_heal::Result<common::storage_compat::DiskStore> {
Err(rustfs_heal::Error::other("Not implemented in mock"))
}
}
@@ -320,11 +320,11 @@ async fn test_heal_task_transient_object_exists_skip_avoids_recreate() {
Ok(Vec::new())
}
async fn get_disk_status(&self, _endpoint: &crate::common::storage_compat::Endpoint) -> rustfs_heal::Result<DiskStatus> {
async fn get_disk_status(&self, _endpoint: &common::storage_compat::Endpoint) -> rustfs_heal::Result<DiskStatus> {
Ok(DiskStatus::Ok)
}
async fn format_disk(&self, _endpoint: &crate::common::storage_compat::Endpoint) -> rustfs_heal::Result<()> {
async fn format_disk(&self, _endpoint: &common::storage_compat::Endpoint) -> rustfs_heal::Result<()> {
Ok(())
}
@@ -394,7 +394,7 @@ async fn test_heal_task_transient_object_exists_skip_avoids_recreate() {
Ok((Vec::new(), None, false))
}
async fn get_disk_for_resume(&self, _set_disk_id: &str) -> rustfs_heal::Result<crate::common::storage_compat::DiskStore> {
async fn get_disk_for_resume(&self, _set_disk_id: &str) -> rustfs_heal::Result<common::storage_compat::DiskStore> {
Err(rustfs_heal::Error::other("not implemented"))
}
}
+1 -1
View File
@@ -14,7 +14,7 @@
mod common;
use crate::common::storage_compat::{
use common::storage_compat::{
ECStore, Endpoint, EndpointServerPools, Endpoints, PoolEndpoints, init_bucket_metadata_sys, init_local_disks,
};
use http::HeaderMap;
@@ -14,7 +14,7 @@
mod common;
use crate::common::storage_compat::{
use common::storage_compat::{
BUCKET_LIFECYCLE_CONFIG, BucketVersioningSys, DiskOption, ECStore, Endpoint, EndpointServerPools, Endpoints,
GLOBAL_TierConfigMgr, PoolEndpoints, ReadCloser, ReaderImpl, STORAGE_FORMAT_FILE, ScannerTestDiskExt as _,
ScannerWarmBackend, TierConfig, TierMinIO, TierType, TransitionOptions, WarmBackendGetOpts, build_transition_put_options,