fix: don't use user specific paths in mcp integration tests (#5445)
This commit is contained in:
@@ -108,22 +108,22 @@ enum TestMode {
|
||||
vec![
|
||||
CallToolRequestParam { name: "text_editor".into(), arguments: Some(object!({
|
||||
"command": "view",
|
||||
"path": "~/goose/crates/goose/tests/tmp/goose.txt"
|
||||
"path": "/tmp/goose_test/goose.txt"
|
||||
}))},
|
||||
CallToolRequestParam { name: "text_editor".into(), arguments: Some(object!({
|
||||
"command": "str_replace",
|
||||
"path": "~/goose/crates/goose/tests/tmp/goose.txt",
|
||||
"path": "/tmp/goose_test/goose.txt",
|
||||
"old_str": "# goose",
|
||||
"new_str": "# goose (modified by test)"
|
||||
}))},
|
||||
// Test shell command to verify file was modified
|
||||
CallToolRequestParam { name: "shell".into(), arguments: Some(object!({
|
||||
"command": "cat ~/goose/crates/goose/tests/tmp/goose.txt"
|
||||
"command": "cat /tmp/goose_test/goose.txt"
|
||||
})) },
|
||||
// Test text_editor tool to restore original content
|
||||
CallToolRequestParam { name: "text_editor".into(), arguments: Some(object!({
|
||||
"command": "str_replace",
|
||||
"path": "~/goose/crates/goose/tests/tmp/goose.txt",
|
||||
"path": "/tmp/goose_test/goose.txt",
|
||||
"old_str": "# goose (modified by test)",
|
||||
"new_str": "# goose"
|
||||
}))},
|
||||
@@ -138,6 +138,13 @@ async fn test_replayed_session(
|
||||
required_envs: Vec<&str>,
|
||||
) {
|
||||
std::env::set_var("GOOSE_MCP_CLIENT_VERSION", "0.0.0");
|
||||
|
||||
// Setup test file for developer extension tests
|
||||
let test_file_path = "/tmp/goose_test/goose.txt";
|
||||
if let Some(parent) = std::path::Path::new(test_file_path).parent() {
|
||||
fs::create_dir_all(parent).ok();
|
||||
}
|
||||
fs::write(test_file_path, "# goose\n").ok();
|
||||
let replay_file_name = command
|
||||
.iter()
|
||||
.map(|s| s.replace("/", "_"))
|
||||
|
||||
+7
-7
@@ -10,19 +10,19 @@ STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"}
|
||||
STDERR: [2m2025-09-27T04:13:30.418172Z[0m [32m INFO[0m [1;32mrmcp::handler::server[0m[32m: [32mclient initialized[0m
|
||||
STDERR: [2;3mat[0m /Users/angiej/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.6.2/src/handler/server.rs:218
|
||||
STDERR:
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"progressToken":0},"name":"text_editor","arguments":{"command":"view","path":"~/goose/crates/goose/tests/tmp/goose.txt"}}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"progressToken":0},"name":"text_editor","arguments":{"command":"view","path":"/tmp/goose_test/goose.txt"}}}
|
||||
STDERR: [2m2025-09-27T04:13:30.418412Z[0m [32m INFO[0m [1;32mrmcp::service[0m[32m: [32mService initialized as server, [1;32mpeer_info[0m[32m: Some(InitializeRequestParam { protocol_version: ProtocolVersion("2025-03-26"), capabilities: ClientCapabilities { experimental: None, roots: None, sampling: None, elicitation: None }, client_info: Implementation { name: "goose", version: "1.9.0" } })[0m
|
||||
STDERR: [2;3mat[0m /Users/angiej/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.6.2/src/service.rs:561
|
||||
STDERR: [2;3min[0m rmcp::service::[1mserve_inner[0m
|
||||
STDERR:
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"resource","resource":{"uri":"file:///Users/angiej/goose/crates/goose/tests/tmp/goose.txt","mimeType":"text","text":"# goose\n"},"annotations":{"audience":["assistant"]}},{"type":"text","text":"### /Users/angiej/goose/crates/goose/tests/tmp/goose.txt\n```\n1: # goose\n```\n","annotations":{"audience":["user"],"priority":0.0}}],"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"progressToken":1},"name":"text_editor","arguments":{"command":"str_replace","new_str":"# goose (modified by test)","old_str":"# goose","path":"~/goose/crates/goose/tests/tmp/goose.txt"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"The file /Users/angiej/goose/crates/goose/tests/tmp/goose.txt has been edited, and the section now reads:\n```\n# goose (modified by test)\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"```\n# goose (modified by test)\n```\n","annotations":{"audience":["user"],"priority":0.2}}],"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"_meta":{"progressToken":2},"name":"shell","arguments":{"command":"cat ~/goose/crates/goose/tests/tmp/goose.txt"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"resource","resource":{"uri":"file:///tmp/goose_test/goose.txt","mimeType":"text","text":"# goose\n"},"annotations":{"audience":["assistant"]}},{"type":"text","text":"### /tmp/goose_test/goose.txt\n```\n1: # goose\n```\n","annotations":{"audience":["user"],"priority":0.0}}],"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"progressToken":1},"name":"text_editor","arguments":{"command":"str_replace","new_str":"# goose (modified by test)","old_str":"# goose","path":"/tmp/goose_test/goose.txt"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"The file /tmp/goose_test/goose.txt has been edited, and the section now reads:\n```\n# goose (modified by test)\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"```\n# goose (modified by test)\n```\n","annotations":{"audience":["user"],"priority":0.2}}],"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"_meta":{"progressToken":2},"name":"shell","arguments":{"command":"cat /tmp/goose_test/goose.txt"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","logger":"shell_tool","data":{"type":"shell_output","stream":"stdout","output":"# goose (modified by test)"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"# goose (modified by test)\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"# goose (modified by test)\n","annotations":{"audience":["user"],"priority":0.0}}],"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"_meta":{"progressToken":3},"name":"text_editor","arguments":{"command":"str_replace","new_str":"# goose","old_str":"# goose (modified by test)","path":"~/goose/crates/goose/tests/tmp/goose.txt"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":4,"result":{"content":[{"type":"text","text":"The file /Users/angiej/goose/crates/goose/tests/tmp/goose.txt has been edited, and the section now reads:\n```\n# goose\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"```\n# goose\n```\n","annotations":{"audience":["user"],"priority":0.2}}],"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"_meta":{"progressToken":3},"name":"text_editor","arguments":{"command":"str_replace","new_str":"# goose","old_str":"# goose (modified by test)","path":"/tmp/goose_test/goose.txt"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":4,"result":{"content":[{"type":"text","text":"The file /tmp/goose_test/goose.txt has been edited, and the section now reads:\n```\n# goose\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"```\n# goose\n```\n","annotations":{"audience":["user"],"priority":0.2}}],"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"_meta":{"progressToken":4},"name":"list_windows","arguments":{}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":5,"result":{"content":[{"type":"text","text":"Available windows:\nMenubar","annotations":{"audience":["assistant"]}},{"type":"text","text":"Available windows:\nMenubar","annotations":{"audience":["user"],"priority":0.0}}],"isError":false}}
|
||||
STDERR: [2m2025-09-27T04:13:30.505916Z[0m [32m INFO[0m [1;32mrmcp::service[0m[32m: [32minput stream terminated[0m
|
||||
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"type": "resource",
|
||||
"resource": {
|
||||
"uri": "file:///Users/angiej/goose/crates/goose/tests/tmp/goose.txt",
|
||||
"uri": "file:///tmp/goose_test/goose.txt",
|
||||
"mimeType": "text",
|
||||
"text": "# goose\n"
|
||||
},
|
||||
@@ -15,7 +15,7 @@
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "### /Users/angiej/goose/crates/goose/tests/tmp/goose.txt\n```\n1: # goose\n```\n",
|
||||
"text": "### /tmp/goose_test/goose.txt\n```\n1: # goose\n```\n",
|
||||
"annotations": {
|
||||
"audience": [
|
||||
"user"
|
||||
@@ -27,7 +27,7 @@
|
||||
[
|
||||
{
|
||||
"type": "text",
|
||||
"text": "The file /Users/angiej/goose/crates/goose/tests/tmp/goose.txt has been edited, and the section now reads:\n```\n# goose (modified by test)\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n",
|
||||
"text": "The file /tmp/goose_test/goose.txt has been edited, and the section now reads:\n```\n# goose (modified by test)\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n",
|
||||
"annotations": {
|
||||
"audience": [
|
||||
"assistant"
|
||||
@@ -69,7 +69,7 @@
|
||||
[
|
||||
{
|
||||
"type": "text",
|
||||
"text": "The file /Users/angiej/goose/crates/goose/tests/tmp/goose.txt has been edited, and the section now reads:\n```\n# goose\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n",
|
||||
"text": "The file /tmp/goose_test/goose.txt has been edited, and the section now reads:\n```\n# goose\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n",
|
||||
"annotations": {
|
||||
"audience": [
|
||||
"assistant"
|
||||
|
||||
Reference in New Issue
Block a user