(dispatcher: Dispatcher, wal: Arc<WalManager>)
| 72 | } |
| 73 | |
| 74 | fn new_inner(dispatcher: Dispatcher, wal: Arc<WalManager>) -> Arc<Self> { |
| 75 | let shutdown = Arc::new(crate::control::shutdown::ShutdownWatch::new()); |
| 76 | let loop_registry = Arc::new(crate::control::shutdown::LoopRegistry::new()); |
| 77 | // Test helpers get a pre-fired gate so listeners start accepting |
| 78 | // immediately. Production code (main.rs) replaces this with a real |
| 79 | // StartupSequencer after calling `SharedState::open`. |
| 80 | let startup_gate = crate::control::startup::StartupGate::pre_fired(); |
| 81 | let test_id = Self::unique_test_id(); |
| 82 | let test_credentials = Arc::new(CredentialStore::new()); |
| 83 | let test_surrogate_registry: crate::control::surrogate::SurrogateRegistryHandle = Arc::new( |
| 84 | std::sync::RwLock::new(crate::control::surrogate::SurrogateRegistry::new()), |
| 85 | ); |
| 86 | let test_surrogate_assigner = Arc::new(crate::control::surrogate::SurrogateAssigner::new( |
| 87 | Arc::clone(&test_surrogate_registry), |
| 88 | Arc::clone(&test_credentials), |
| 89 | Arc::new(crate::control::surrogate::NoopWalAppender), |
| 90 | )); |
| 91 | let shared_audit = Arc::new(Mutex::new(AuditLog::new(10_000))); |
| 92 | let test_session_registry = |
| 93 | Arc::new(crate::control::security::sessions::SessionRegistry::new()); |
| 94 | let (si_bus, uc_bus, bus_consumer_task) = super::buses_init::init_security_buses( |
| 95 | Arc::clone(&shared_audit), |
| 96 | Arc::clone(&test_session_registry), |
| 97 | ); |
| 98 | let bus_consumer_handle = Some(bus_consumer_task); |
| 99 | // Wire buses into the credential store so test mutations publish events. |
| 100 | test_credentials.set_buses( |
| 101 | Arc::new( |
| 102 | crate::control::security::buses::SessionInvalidationBus::from_existing( |
| 103 | si_bus.sender(), |
| 104 | ), |
| 105 | ), |
| 106 | Arc::new( |
| 107 | crate::control::security::buses::UserChangeBus::from_existing(uc_bus.sender()), |
| 108 | ), |
| 109 | ); |
| 110 | |
| 111 | let state = Arc::new(Self { |
| 112 | dispatcher: Mutex::new(dispatcher), |
| 113 | tracker: RequestTracker::new(), |
| 114 | wal, |
| 115 | quiesce: crate::bridge::quiesce::CollectionQuiesce::new(), |
| 116 | http_client: Arc::new(reqwest::Client::new()), |
| 117 | credentials: Arc::clone(&test_credentials), |
| 118 | audit: shared_audit, |
| 119 | api_keys: ApiKeyStore::new(), |
| 120 | roles: RoleStore::new(), |
| 121 | permissions: PermissionStore::new(), |
| 122 | tenants: Mutex::new(TenantIsolation::new(TenantQuota::default())), |
| 123 | cluster_topology: None, |
| 124 | cluster_routing: None, |
| 125 | cluster_transport: None, |
| 126 | node_id: 0, |
| 127 | metadata_cache: Arc::new(std::sync::RwLock::new(nodedb_cluster::MetadataCache::new())), |
| 128 | catalog_change_tx: tokio::sync::broadcast::channel( |
| 129 | crate::control::cluster::metadata_applier::CATALOG_CHANNEL_CAPACITY, |
| 130 | ) |
| 131 | .0, |
nothing calls this directly
no test coverage detected