Skip to content

Commit 14a205f

Browse files
committed
Enhance MCP feature tests and streamline Llama Stack storage clearing
- Added checks to ensure the response body does not contain 'mcp-client' in MCP feature tests. - Simplified the `clear_llama_stack_storage` function to remove the entire `~/.llama` directory instead of specific files, improving clarity and efficiency. - Updated comments to reflect the changes in storage clearing logic.
1 parent bcd351f commit 14a205f

2 files changed

Lines changed: 15 additions & 23 deletions

File tree

tests/e2e/features/mcp.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ Feature: MCP tests
218218
{"query": "Say hello", "model": "{MODEL}", "provider": "{PROVIDER}"}
219219
"""
220220
Then The status code of the response is 200
221+
And The body of the response does not contain mcp-client
221222
And The response should contain following fragments
222223
| Fragments in LLM response |
223224
| Hello |
@@ -233,6 +234,7 @@ Feature: MCP tests
233234
"""
234235
When I wait for the response to be completed
235236
Then The status code of the response is 200
237+
And The body of the response does not contain mcp-client
236238
And The streamed response should contain following fragments
237239
| Fragments in LLM response |
238240
| Hello |

tests/e2e/utils/utils.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -246,41 +246,31 @@ def remove_config_backup(backup_path: str) -> None:
246246
print(f"Warning: Could not remove backup file {backup_path}: {e}")
247247

248248

249-
# Llama Stack storage paths inside the lightspeed-stack container/pod (library mode).
250-
# Used when clearing embedded Llama Stack storage before MCP config scenarios.
251-
_LLAMA_STORAGE_ROOT = "/opt/app-root/src/.llama/storage"
252-
253-
254249
def clear_llama_stack_storage(container_name: str = "lightspeed-stack") -> None:
255250
"""Clear Llama Stack storage in library mode (embedded Llama Stack).
256251
257-
Removes SQLite/KV store databases and file storage contents so that
258-
toolgroups and other persisted state are reset. Used before MCP config
259-
scenarios when not running in server mode (no separate Llama Stack to
260-
unregister toolgroups from). Only runs when using Docker (skipped in Prow).
252+
Removes the ~/.llama directory so that toolgroups and other persisted
253+
state are reset. Used before MCP config scenarios when not running in
254+
server mode (no separate Llama Stack to unregister toolgroups from).
255+
Only runs when using Docker (skipped in Prow).
261256
262257
Parameters:
263258
container_name (str): Docker container name (default "lightspeed-stack").
264259
265260
Returns:
266261
None
267262
"""
263+
if is_prow_environment():
264+
return
268265

269-
storage_root = _LLAMA_STORAGE_ROOT
270-
commands = [
271-
f"rm -f {storage_root}/rag/kv_store.db",
272-
f"rm -f {storage_root}/sql_store.db",
273-
f"rm -rf {storage_root}/files/*",
274-
]
275266
try:
276-
for cmd in commands:
277-
subprocess.run(
278-
["docker", "exec", container_name, "sh", "-c", cmd],
279-
capture_output=True,
280-
text=True,
281-
timeout=10,
282-
check=False,
283-
)
267+
subprocess.run(
268+
["docker", "exec", container_name, "sh", "-c", "rm -rf ~/.llama"],
269+
capture_output=True,
270+
text=True,
271+
timeout=10,
272+
check=False,
273+
)
284274
except subprocess.TimeoutExpired as e:
285275
print(f"Warning: Could not clear Llama Stack storage: {e}")
286276

0 commit comments

Comments
 (0)