Skip to content

Commit 2869425

Browse files
author
Terraphim CI
committed
test: remove desktop MCP integration tests from terraphim_mcp_server
1 parent dda6437 commit 2869425

3 files changed

Lines changed: 0 additions & 266 deletions

File tree

crates/terraphim_mcp_server/tests/desktop_mcp_integration.rs

Lines changed: 0 additions & 87 deletions
This file was deleted.

crates/terraphim_mcp_server/tests/mcp_rolegraph_validation_test.rs

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use anyhow::Result;
22
use rmcp::{model::CallToolRequestParam, service::ServiceExt, transport::TokioChildProcess};
33
use serial_test::serial;
4-
use std::path::PathBuf;
54
use terraphim_config::{
65
ConfigBuilder, Haystack, KnowledgeGraph, KnowledgeGraphLocal, Role, ServiceType,
76
};
@@ -15,36 +14,6 @@ use terraphim_automata::builder::{Logseq, ThesaurusBuilder};
1514
use terraphim_persistence::DeviceStorage;
1615
use terraphim_persistence::Persistable;
1716

18-
fn resolve_desktop_binary() -> Result<Option<PathBuf>> {
19-
if let Ok(path) = std::env::var("TERRAPHIM_DESKTOP_BINARY") {
20-
let path = PathBuf::from(path);
21-
if path.exists() {
22-
return Ok(Some(path));
23-
}
24-
anyhow::bail!(
25-
"TERRAPHIM_DESKTOP_BINARY is set but file does not exist: {}",
26-
path.display()
27-
);
28-
}
29-
30-
let current_dir = std::env::current_dir()?;
31-
let project_root = current_dir
32-
.parent()
33-
.and_then(|p| p.parent())
34-
.ok_or_else(|| anyhow::anyhow!("Cannot find workspace root"))?;
35-
let binary_name = if cfg!(target_os = "windows") {
36-
"terraphim-ai-desktop.exe"
37-
} else {
38-
"terraphim-ai-desktop"
39-
};
40-
let desktop_binary = project_root.join("target").join("debug").join(binary_name);
41-
if desktop_binary.exists() {
42-
Ok(Some(desktop_binary))
43-
} else {
44-
Ok(None)
45-
}
46-
}
47-
4817
/// Create a configuration with the correct "Terraphim Engineer" role
4918
/// that uses local KG files and builds thesaurus from local markdown files
5019
async fn create_terraphim_engineer_config() -> Result<String> {
@@ -296,80 +265,6 @@ async fn test_mcp_server_terraphim_engineer_search() -> Result<()> {
296265
Ok(())
297266
}
298267

299-
/// Test desktop CLI integration with MCP server
300-
#[tokio::test]
301-
#[serial]
302-
async fn test_desktop_cli_mcp_search() -> Result<()> {
303-
// Use memory-only persistence to avoid database conflicts between tests
304-
set_env_var("TERRAPHIM_PROFILE_MEMORY_TYPE", "memory");
305-
306-
println!("🖥️ Testing desktop CLI with MCP server...");
307-
308-
let Some(desktop_binary) = resolve_desktop_binary()? else {
309-
eprintln!(
310-
"Skipping desktop CLI MCP test: set TERRAPHIM_DESKTOP_BINARY to external terraphim-ai-desktop binary"
311-
);
312-
return Ok(());
313-
};
314-
315-
// Test that desktop binary can run in MCP server mode
316-
let mut cmd = Command::new(&desktop_binary);
317-
cmd.arg("mcp-server")
318-
.stdin(std::process::Stdio::piped())
319-
.stdout(std::process::Stdio::piped())
320-
.stderr(std::process::Stdio::piped());
321-
322-
let transport = TokioChildProcess::new(cmd)?;
323-
let service = ().serve(transport).await?;
324-
325-
println!("✅ Desktop CLI running in MCP server mode");
326-
327-
// Update config and test search - same as above
328-
let config_json = create_terraphim_engineer_config().await?;
329-
330-
let config_result = service
331-
.call_tool(CallToolRequestParam {
332-
name: "update_config_tool".into(),
333-
arguments: serde_json::json!({
334-
"config_str": config_json
335-
})
336-
.as_object()
337-
.cloned(),
338-
})
339-
.await?;
340-
341-
assert!(
342-
!config_result.is_error.unwrap_or(false),
343-
"Config update should succeed"
344-
);
345-
346-
// Test search
347-
let search_result = service
348-
.call_tool(CallToolRequestParam {
349-
name: "search".into(),
350-
arguments: serde_json::json!({
351-
"query": "terraphim-graph",
352-
"limit": 3
353-
})
354-
.as_object()
355-
.cloned(),
356-
})
357-
.await?;
358-
359-
assert!(
360-
!search_result.is_error.unwrap_or(false),
361-
"Search should succeed"
362-
);
363-
364-
let result_count = search_result.content.len().saturating_sub(1);
365-
assert!(result_count > 0, "Should find terraphim-graph documents");
366-
367-
service.cancel().await?;
368-
println!("✅ Desktop CLI MCP server working correctly");
369-
370-
Ok(())
371-
}
372-
373268
/// Test role switching via config API before search
374269
#[tokio::test]
375270
#[serial]

crates/terraphim_mcp_server/tests/test_mcp_fixes_validation.rs

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,9 @@
11
use anyhow::Result;
22
use rmcp::{model::CallToolRequestParam, service::ServiceExt, transport::TokioChildProcess};
33
use serde_json::json;
4-
use std::path::PathBuf;
54
use std::process::Stdio;
65
use tokio::process::Command;
76

8-
fn resolve_desktop_binary() -> Result<Option<PathBuf>> {
9-
if let Ok(path) = std::env::var("TERRAPHIM_DESKTOP_BINARY") {
10-
let path = PathBuf::from(path);
11-
if path.exists() {
12-
return Ok(Some(path));
13-
}
14-
anyhow::bail!(
15-
"TERRAPHIM_DESKTOP_BINARY is set but file does not exist: {}",
16-
path.display()
17-
);
18-
}
19-
20-
let crate_dir = std::env::current_dir()?;
21-
let binary_name = if cfg!(target_os = "windows") {
22-
"terraphim-ai-desktop.exe"
23-
} else {
24-
"terraphim-ai-desktop"
25-
};
26-
27-
let workspace_root = crate_dir
28-
.parent()
29-
.and_then(|p| p.parent())
30-
.ok_or_else(|| anyhow::anyhow!("Cannot find workspace root"))?;
31-
let candidate = workspace_root
32-
.join("target")
33-
.join("debug")
34-
.join(binary_name);
35-
if candidate.exists() {
36-
Ok(Some(candidate))
37-
} else {
38-
Ok(None)
39-
}
40-
}
41-
427
/// Test that MCP server properly separates logs from JSON-RPC responses
438
#[tokio::test]
449
async fn test_mcp_log_separation_and_tools() -> Result<()> {
@@ -171,45 +136,6 @@ async fn test_mcp_log_separation_and_tools() -> Result<()> {
171136
Ok(())
172137
}
173138

174-
/// Test that desktop MCP integration works without --ignored flag
175-
#[tokio::test]
176-
async fn test_desktop_mcp_integration_fixed() -> Result<()> {
177-
println!("🖥️ Testing desktop MCP integration");
178-
let Some(desktop_binary) = resolve_desktop_binary()? else {
179-
eprintln!(
180-
"Skipping desktop MCP integration test: set TERRAPHIM_DESKTOP_BINARY to external terraphim-ai-desktop binary"
181-
);
182-
return Ok(());
183-
};
184-
185-
println!("✅ Desktop binary available at: {:?}", desktop_binary);
186-
187-
// Test desktop in MCP server mode
188-
let mut cmd = Command::new(desktop_binary);
189-
cmd.arg("mcp-server")
190-
.stdin(Stdio::piped())
191-
.stdout(Stdio::piped())
192-
.stderr(Stdio::piped());
193-
194-
let transport = TokioChildProcess::new(cmd)?;
195-
let service = ().serve(transport).await?;
196-
197-
println!("✅ Desktop MCP server connected: {:?}", service.peer_info());
198-
199-
// Basic functionality test
200-
let tools = service.list_tools(Default::default()).await?;
201-
assert!(
202-
!tools.tools.is_empty(),
203-
"Desktop MCP server should expose tools"
204-
);
205-
206-
println!(
207-
"✅ Desktop MCP integration test passed with {} tools",
208-
tools.tools.len()
209-
);
210-
Ok(())
211-
}
212-
213139
/// Test MCP server with role switching and configuration updates
214140
#[tokio::test]
215141
async fn test_mcp_role_configuration() -> Result<()> {

0 commit comments

Comments
 (0)