Skip to content

Commit 9ada661

Browse files
AlexMikhalevTerraphim AI
andcommitted
fix(tests): parse role name from list output before passing to select
The roles list output format is "* Role Name (shortname)" but the test was passing the entire string including marker and shortname to roles select, which failed because no role matched the literal string. Co-Authored-By: Terraphim AI <noreply@terraphim.io>
1 parent f3f1c9d commit 9ada661

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

crates/terraphim_agent/tests/server_mode_tests.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,15 @@ async fn test_server_mode_roles_select() -> Result<()> {
309309
return Ok(());
310310
}
311311

312-
// Select the first available role
313-
let role_name = available_roles[0].trim();
312+
// Parse role name from list output format: " * Role Name (shortname)" or " Role Name"
313+
// Strip the leading marker (* or space) and trailing (shortname) if present
314+
let raw_line = available_roles[0].trim();
315+
let without_marker = raw_line.trim_start_matches('*').trim();
316+
let role_name = if let Some(paren_pos) = without_marker.rfind(" (") {
317+
without_marker[..paren_pos].trim()
318+
} else {
319+
without_marker
320+
};
314321
println!("Selecting role: {}", role_name);
315322

316323
let (stdout, stderr, code) = run_server_command(&server_url, &["roles", "select", role_name])?;

0 commit comments

Comments
 (0)