()
| 161 | use std::time::Duration; |
| 162 | |
| 163 | async fn state_with_issuer() -> Arc<ServerState> { |
| 164 | let mat = generate_jwt_key().expect("jwt key"); |
| 165 | let store = Arc::new( |
| 166 | Store::connect("sqlite::memory:?cache=shared") |
| 167 | .await |
| 168 | .unwrap(), |
| 169 | ); |
| 170 | let compute = new_test_runtime(store.clone()).await; |
| 171 | let mut state = ServerState::new( |
| 172 | Config::new(None).with_database_url("sqlite::memory:?cache=shared"), |
| 173 | store, |
| 174 | compute, |
| 175 | SandboxIndex::new(), |
| 176 | SandboxWatchBus::new(), |
| 177 | TracingLogBus::new(), |
| 178 | Arc::new(SupervisorSessionRegistry::new()), |
| 179 | None, |
| 180 | ); |
| 181 | // We don't need the authenticator for these tests; only the issuer. |
| 182 | let issuer = SandboxJwtIssuer::from_pem( |
| 183 | mat.signing_key_pem.as_bytes(), |
| 184 | mat.kid, |
| 185 | "test-gateway", |
| 186 | Duration::from_secs(3600), |
| 187 | ) |
| 188 | .unwrap(); |
| 189 | state.sandbox_jwt_issuer = Some(Arc::new(issuer)); |
| 190 | let state = Arc::new(state); |
| 191 | insert_sandbox(&state, "sandbox-a").await; |
| 192 | state |
| 193 | } |
| 194 | |
| 195 | async fn insert_sandbox(state: &Arc<ServerState>, sandbox_id: &str) { |
| 196 | let mut sandbox = Sandbox { |
no test coverage detected