refactor(config): migrate server config consumers (#3353)

This commit is contained in:
安正超
2026-06-11 17:04:50 +08:00
committed by GitHub
parent 2205991180
commit ca58d7f0ec
53 changed files with 238 additions and 213 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
//! Tests for audit configuration parsing and validation
use rustfs_ecstore::config::KVS;
use rustfs_config::server_config::KVS;
#[test]
fn test_webhook_valid_fields() {
+1 -1
View File
@@ -13,7 +13,7 @@
// limitations under the License.
use rustfs_audit::*;
use rustfs_ecstore::config::{Config, KVS};
use rustfs_config::server_config::{Config, KVS};
use std::collections::HashMap;
use temp_env::with_vars;
+5 -5
View File
@@ -26,7 +26,7 @@ async fn test_audit_system_startup_performance() {
let start = Instant::now();
// Create minimal config for testing
let config = rustfs_ecstore::config::Config(std::collections::HashMap::new());
let config = rustfs_config::server_config::Config(std::collections::HashMap::new());
// System should start quickly even with empty config
let _result = timeout(Duration::from_secs(5), system.start(config)).await;
@@ -47,12 +47,12 @@ async fn test_concurrent_target_creation() {
let registry = AuditRegistry::new();
// Create config with multiple webhook instances
let mut config = rustfs_ecstore::config::Config(std::collections::HashMap::new());
let mut config = rustfs_config::server_config::Config(std::collections::HashMap::new());
let mut webhook_section = std::collections::HashMap::new();
// Create multiple instances for concurrent creation test
for i in 1..=5 {
let mut kvs = rustfs_ecstore::config::KVS::new();
let mut kvs = rustfs_config::server_config::KVS::new();
kvs.insert("enable".to_string(), "on".to_string());
kvs.insert("endpoint".to_string(), format!("http://localhost:302{i}/webhook"));
webhook_section.insert(format!("instance_{i}"), kvs);
@@ -90,7 +90,7 @@ async fn test_audit_log_dispatch_performance() {
let system = AuditSystem::new();
// Create minimal config
let config = rustfs_ecstore::config::Config(HashMap::new());
let config = rustfs_config::server_config::Config(HashMap::new());
let start_result = system.start(config).await;
if start_result.is_err() {
println!("AuditSystem failed to start: {start_result:?}");
@@ -186,7 +186,7 @@ async fn test_system_state_transitions() {
assert_eq!(system.get_state().await, rustfs_audit::system::AuditSystemState::Stopped);
// Start system
let config = rustfs_ecstore::config::Config(std::collections::HashMap::new());
let config = rustfs_config::server_config::Config(std::collections::HashMap::new());
let start_result = system.start(config).await;
// Empty config keeps the audit system stopped even when start() succeeds.
@@ -15,7 +15,7 @@
//! Comprehensive integration tests for the complete audit system
use rustfs_audit::*;
use rustfs_ecstore::config::{Config, KVS};
use rustfs_config::server_config::{Config, KVS};
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;