Skip to content

Commit c58bbe1

Browse files
are-cesclaude
andcommitted
LCORE-1422: Replace @InlineRAG magic tag with explicit Background step
Replace the implicit @InlineRAG feature tag (handled in environment.py hooks) with a parameterized Background step "The service uses the {config_name} configuration" that switches config and restarts the container. The step is reusable for any config file and idempotent within a feature run via backup file existence check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3f5f0c9 commit c58bbe1

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

tests/e2e/features/inline_rag.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
@InlineRAG
21
Feature: Inline RAG (BYOK) support tests
32

43
Background:
54
Given The service is started locally
65
And REST API service prefix is /v1
6+
And The service uses the lightspeed-stack-inline-rag.yaml configuration
77

88
Scenario: Check if inline RAG source is registered
99
Given The system is in default state

tests/e2e/features/steps/common.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
from behave import given # pyright: ignore[reportAttributeAccessIssue]
66
from behave.runner import Context
77

8+
from tests.e2e.utils.utils import (
9+
create_config_backup,
10+
is_prow_environment,
11+
restart_container,
12+
switch_config,
13+
wait_for_container_health,
14+
)
15+
816

917
@given("The service is started locally")
1018
def service_is_started_locally(context: Context) -> None:
@@ -23,6 +31,34 @@ def service_is_started_locally(context: Context) -> None:
2331
context.port_llama = os.getenv("E2E_LLAMA_PORT", "8321")
2432

2533

34+
@given("The service uses the {config_name} configuration") # type: ignore
35+
def configure_service(context: Context, config_name: str) -> None:
36+
"""Switch to the given configuration if not already active.
37+
38+
On first call creates a backup of the current config, switches to the
39+
named config, and restarts the container. Subsequent calls within
40+
the same feature are no-ops (detected by backup file existence in Docker
41+
or backup key presence in Prow).
42+
43+
Parameters:
44+
context (Context): Behave context.
45+
config_name (str): Config filename (e.g. lightspeed-stack-inline-rag.yaml).
46+
"""
47+
if not is_prow_environment() and os.path.exists("lightspeed-stack.yaml.backup"):
48+
return
49+
50+
mode_dir = "library-mode" if context.is_library_mode else "server-mode"
51+
if is_prow_environment():
52+
config_path = f"tests/e2e-prow/rhoai/configs/{config_name}"
53+
else:
54+
config_path = f"tests/e2e/configuration/{mode_dir}/{config_name}"
55+
create_config_backup("lightspeed-stack.yaml")
56+
switch_config(config_path)
57+
restart_container("lightspeed-stack")
58+
# Library mode needs extra time to load embedding models after restart
59+
wait_for_container_health("lightspeed-stack", max_attempts=12)
60+
61+
2662
@given("The system is in default state")
2763
def system_in_default_state(context: Context) -> None:
2864
"""Check the default system state.

0 commit comments

Comments
 (0)