Skip to content

Commit 7e8a728

Browse files
committed
fixed library mode tests error
1 parent 3a436f7 commit 7e8a728

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

tests/e2e/features/environment.py

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -224,29 +224,22 @@ def before_scenario(context: Context, scenario: Scenario) -> None:
224224
switch_config(context.scenario_config)
225225
restart_container("lightspeed-stack")
226226

227+
config_name: str | None = None
227228
if "MCPFileAuthConfig" in scenario.effective_tags:
228-
context.scenario_config = _get_config_path("mcp-file-auth", mode_dir)
229-
unregister_mcp_toolgroups()
230-
switch_config(context.scenario_config)
231-
restart_container("lightspeed-stack")
232-
if "InvalidMCPFileAuthConfig" in scenario.effective_tags:
233-
context.scenario_config = _get_config_path("invalid-mcp-file-auth", mode_dir)
234-
unregister_mcp_toolgroups()
235-
switch_config(context.scenario_config)
236-
restart_container("lightspeed-stack")
237-
if "MCPKubernetesAuthConfig" in scenario.effective_tags:
238-
context.scenario_config = _get_config_path("mcp-kubernetes-auth", mode_dir)
239-
unregister_mcp_toolgroups()
240-
switch_config(context.scenario_config)
241-
restart_container("lightspeed-stack")
242-
if "MCPClientAuthConfig" in scenario.effective_tags:
243-
context.scenario_config = _get_config_path("mcp-client-auth", mode_dir)
244-
unregister_mcp_toolgroups()
245-
switch_config(context.scenario_config)
246-
restart_container("lightspeed-stack")
247-
if "MCPOAuthAuthConfig" in scenario.effective_tags:
248-
context.scenario_config = _get_config_path("mcp-oauth-auth", mode_dir)
249-
unregister_mcp_toolgroups()
229+
config_name = "mcp-file-auth"
230+
elif "InvalidMCPFileAuthConfig" in scenario.effective_tags:
231+
config_name = "invalid-mcp-file-auth"
232+
elif "MCPKubernetesAuthConfig" in scenario.effective_tags:
233+
config_name = "mcp-kubernetes-auth"
234+
elif "MCPClientAuthConfig" in scenario.effective_tags:
235+
config_name = "mcp-client-auth"
236+
elif "MCPOAuthAuthConfig" in scenario.effective_tags:
237+
config_name = "mcp-oauth-auth"
238+
239+
if config_name is not None:
240+
if not context.is_library_mode:
241+
unregister_mcp_toolgroups()
242+
context.scenario_config = _get_config_path(config_name, mode_dir)
250243
switch_config(context.scenario_config)
251244
restart_container("lightspeed-stack")
252245

tests/e2e/utils/llama_stack_tools.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
"""E2E helpers to unregister and re-register Llama Stack shields via the client API.
1+
"""E2E test utilities for managing Llama Stack MCP toolgroups.
22
3-
Used by the @disable-shields tag: before the scenario we call client.shields.delete()
4-
to unregister the shield; after the scenario we call client.shields.register()
5-
to restore it. Only applies in server mode (Llama Stack as a separate service).
6-
Requires E2E_LLAMA_STACK_URL or E2E_LLAMA_HOSTNAME/E2E_LLAMA_PORT.
3+
This module provides functions to unregister (delete) MCP-related toolgroups from
4+
a running Llama Stack instance during end-to-end tests. These utilities are intended to
5+
reset Llama Stack toolgroup state between scenarios that involve dynamic toolgroup registration,
6+
such as when switching configurations or testing various MCP authentication methods.
7+
8+
Only applies when running Llama Stack as a separate service (server mode).
9+
Requires E2E_LLAMA_STACK_URL or the combination of E2E_LLAMA_HOSTNAME and E2E_LLAMA_PORT
10+
environment variables to locate the Llama Stack instance.
711
"""
812

913
import asyncio

0 commit comments

Comments
 (0)