use mesk::cfg::config::{Config, RouterConfig}; use mesk::router::manager::RouterManager; #[tokio::test] async fn test_router_manager_creation() { let config = Config { repo: mesk::cfg::config::Repo { repo_url: "https://mesk.anthrill.i2p/repo/x86_64/".to_string(), auto_update: true, destination: (String::from("mesk"), String::from("mesk")), repo_http_url: Some("http://github.com/Anthrill/repo-mirror/x86_64".to_string()), i2p_http_proxy_port: 4444, }, log: mesk::cfg::config::Log { log_file: "/tmp/mesk_test.log".to_string(), log_level: mesk::cfg::config::Loglevel::Debug, }, paths: mesk::cfg::config::Paths { cache_dir: "/tmp/mesk_cache".to_string(), build_dir: "/tmp/mesk_build".to_string(), installed_db: "/tmp/mesk_pkgdb".to_string(), }, router: RouterConfig { integrated_router: false, // Disable router for this test to avoid conflicts storage_path: "/tmp/mesk_test_router/".to_string(), http_proxy_port: 4447, socks_proxy_port: 4448, auto_update: false, }, }; let result = RouterManager::new(&config).await; assert!(result.is_ok()); let manager = result.unwrap(); assert_eq!(manager.is_running(), false); } #[tokio::test] async fn test_router_manager_with_disabled_router() { let config = Config { repo: mesk::cfg::config::Repo { repo_url: "https://mesk.anthrill.i2p/repo/x86_64/".to_string(), auto_update: true, destination: (String::from("mesk"), String::from("mesk")), repo_http_url: Some("http://github.com/Anthrill/repo-mirror/x86_64".to_string()), i2p_http_proxy_port: 4444, }, log: mesk::cfg::config::Log { log_file: "/tmp/mesk_test.log".to_string(), log_level: mesk::cfg::config::Loglevel::Debug, }, paths: mesk::cfg::config::Paths { cache_dir: "/tmp/mesk_cache".to_string(), build_dir: "/tmp/mesk_build".to_string(), installed_db: "/tmp/mesk_pkgdb".to_string(), }, router: RouterConfig { integrated_router: false, // Explicitly disable router storage_path: "/tmp/mesk_test_router/".to_string(), http_proxy_port: 4447, socks_proxy_port: 4448, auto_update: false, }, }; let result = RouterManager::new(&config).await; assert!(result.is_ok()); let manager = result.unwrap(); // When router is disabled, we shouldn't be able to start it let start_result = manager.start().await; // This test checks that disabled router behaves properly // Actual start operations may not work when integrated_router is false println!("Router start result when disabled: {:?}", start_result); assert_eq!(manager.is_running(), false); }