Skip to main content

quantrs2_anneal/advanced_testing_framework/
config.rs

1//! Configuration types for advanced testing framework
2
3use super::{Duration, HashMap};
4
5/// Configuration for the testing framework
6#[derive(Debug, Clone)]
7pub struct TestingConfig {
8    /// Enable parallel test execution
9    pub enable_parallel: bool,
10    /// Maximum concurrent tests
11    pub max_concurrent_tests: usize,
12    /// Test timeout duration
13    pub test_timeout: Duration,
14    /// Performance threshold tolerance
15    pub performance_tolerance: f64,
16    /// Statistical significance level
17    pub significance_level: f64,
18    /// Test data retention period
19    pub data_retention: Duration,
20    /// Enable detailed logging
21    pub detailed_logging: bool,
22    /// Stress test problem sizes
23    pub stress_test_sizes: Vec<usize>,
24}
25
26impl Default for TestingConfig {
27    fn default() -> Self {
28        Self {
29            enable_parallel: true,
30            max_concurrent_tests: 8,
31            test_timeout: Duration::from_secs(300),
32            performance_tolerance: 0.05,
33            significance_level: 0.05,
34            data_retention: Duration::from_secs(30 * 24 * 3600),
35            detailed_logging: true,
36            stress_test_sizes: vec![100, 500, 1000, 2000, 5000],
37        }
38    }
39}
40
41/// Alert thresholds for regression detection
42#[derive(Debug, Clone)]
43pub struct AlertThresholds {
44    /// Performance degradation threshold
45    pub degradation_threshold: f64,
46    /// Statistical significance level
47    pub significance_level: f64,
48    /// Minimum sample size for detection
49    pub min_sample_size: usize,
50    /// Alert cooldown period
51    pub cooldown_period: Duration,
52}
53
54impl Default for AlertThresholds {
55    fn default() -> Self {
56        Self {
57            degradation_threshold: 0.1,
58            significance_level: 0.05,
59            min_sample_size: 10,
60            cooldown_period: Duration::from_secs(3600),
61        }
62    }
63}
64
65/// Data retention policy
66#[derive(Debug, Clone)]
67pub struct RetentionPolicy {
68    /// Retention period
69    pub retention_period: Duration,
70    /// Cleanup frequency
71    pub cleanup_frequency: Duration,
72    /// Archive policy
73    pub archive_policy: Option<ArchivePolicy>,
74}
75
76/// Archive policy for old data
77#[derive(Debug, Clone)]
78pub struct ArchivePolicy {
79    /// Archive location
80    pub archive_location: String,
81    /// Compression enabled
82    pub compression: bool,
83    /// Archive format
84    pub format: ArchiveFormat,
85}
86
87/// Archive format options
88#[derive(Debug, Clone, PartialEq, Eq)]
89pub enum ArchiveFormat {
90    /// JSON format
91    JSON,
92    /// Binary format
93    Binary,
94    /// Compressed format
95    Compressed,
96    /// Custom format
97    Custom(String),
98}
99
100/// Stress test resource constraints
101#[derive(Debug, Clone)]
102pub struct StressResourceConstraints {
103    /// Maximum memory usage (MB)
104    pub max_memory: Option<usize>,
105    /// Maximum CPU usage (0.0-1.0)
106    pub max_cpu: Option<f64>,
107    /// Maximum execution time
108    pub max_time: Option<Duration>,
109    /// Maximum concurrent tests
110    pub max_concurrent: Option<usize>,
111}
112
113/// Platform configuration
114#[derive(Debug, Clone)]
115pub struct PlatformConfig {
116    /// Platform identifier
117    pub platform_id: String,
118    /// Connection parameters
119    pub connection_params: HashMap<String, String>,
120    /// Authentication settings
121    pub auth_settings: Option<AuthSettings>,
122    /// Platform-specific options
123    pub platform_options: HashMap<String, String>,
124}
125
126/// Authentication settings
127#[derive(Debug, Clone)]
128pub struct AuthSettings {
129    /// Authentication type
130    pub auth_type: AuthType,
131    /// Credentials
132    pub credentials: HashMap<String, String>,
133    /// Token expiry
134    pub token_expiry: Option<Duration>,
135}
136
137/// Authentication types
138#[derive(Debug, Clone, PartialEq, Eq)]
139pub enum AuthType {
140    /// API key authentication
141    ApiKey,
142    /// OAuth authentication
143    OAuth,
144    /// Certificate authentication
145    Certificate,
146    /// Custom authentication
147    Custom(String),
148}