MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / state_with_issuer

Function state_with_issuer

crates/openshell-server/src/grpc/auth_rpc.rs:163–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 {

Calls 5

generate_jwt_keyFunction · 0.85
connectFunction · 0.85
new_test_runtimeFunction · 0.85
insert_sandboxFunction · 0.85
with_database_urlMethod · 0.80

Tested by

no test coverage detected