MCPcopy Index your code
hub / github.com/AI45Lab/Code / test_resume_session_restores_artifacts

Function test_resume_session_restores_artifacts

core/src/agent_api/tests.rs:2388–2418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2386
2387#[tokio::test(flavor = "multi_thread")]
2388async fn test_resume_session_restores_artifacts() {
2389 let store = Arc::new(crate::store::MemorySessionStore::new());
2390 let agent = Agent::from_config(test_config()).await.unwrap();
2391
2392 let opts = SessionOptions::new()
2393 .with_session_store(store.clone())
2394 .with_session_id("resume-artifacts-test");
2395 let session = agent.session("/tmp/test-ws-artifacts", Some(opts)).unwrap();
2396 session
2397 .tool_executor
2398 .artifact_store()
2399 .put(crate::tools::ToolArtifact {
2400 artifact_id: "tool-output:test:a".to_string(),
2401 artifact_uri: "a3s://tool-output/test/a".to_string(),
2402 tool_name: "test".to_string(),
2403 content: "artifact content".to_string(),
2404 original_bytes: 16,
2405 shown_bytes: 4,
2406 });
2407
2408 session.save().await.unwrap();
2409 let opts2 = SessionOptions::new().with_session_store(store.clone());
2410 let resumed = agent
2411 .resume_session("resume-artifacts-test", opts2)
2412 .unwrap();
2413
2414 let artifact = resumed
2415 .get_artifact("a3s://tool-output/test/a")
2416 .expect("artifact");
2417 assert_eq!(artifact.content, "artifact content");
2418}
2419
2420#[tokio::test(flavor = "multi_thread")]
2421async fn test_resume_session_restores_trace_events() {

Callers

nothing calls this directly

Calls 11

with_session_storeMethod · 0.80
putMethod · 0.80
expectMethod · 0.80
test_configFunction · 0.70
with_session_idMethod · 0.45
cloneMethod · 0.45
sessionMethod · 0.45
artifact_storeMethod · 0.45
saveMethod · 0.45
resume_sessionMethod · 0.45
get_artifactMethod · 0.45

Tested by

no test coverage detected