limiteron 0.2.10

Unified flow control framework for Rust
Documentation
// Copyright (c) 2026 Kirky.X
// SPDX-License-Identifier: MIT
//! 降级模块集成测试

use limiteron::fallback::{ComponentType, FallbackConfig, FallbackManager, FallbackStrategy};

#[tokio::test]
async fn test_fallback_strategy_variants() {
    // Verify all strategy variants exist
    let _ = FallbackStrategy::FailOpen;
    let _ = FallbackStrategy::FailClosed;
}

#[tokio::test]
async fn test_component_type_variants() {
    let _ = ComponentType::Postgres;
    let _ = ComponentType::Redis;
    let _ = ComponentType::Ban;
    let _ = ComponentType::Quota;
}

#[tokio::test]
async fn test_fallback_config() {
    let config = FallbackConfig::new(ComponentType::Redis, FallbackStrategy::FailClosed);
    assert_eq!(config.component, ComponentType::Redis);
    assert_eq!(config.strategy, FallbackStrategy::FailClosed);
    assert!(config.enabled);
}

#[tokio::test]
async fn test_fallback_config_builder() {
    let config = FallbackConfig::new(ComponentType::Config, FallbackStrategy::FailOpen)
        .timeout(std::time::Duration::from_secs(5))
        .max_retries(3);
    assert!(config.enabled); // Default::default() sets enabled=true
    assert_eq!(config.timeout, std::time::Duration::from_secs(5));
    assert_eq!(config.max_retries, 3);
}