Skip to content

Commit e671522

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 an explicit Background step "The service uses inline RAG configuration" that switches config and restarts the container. The step is idempotent within a feature run via backup file existence check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4fc705b commit e671522

3 files changed

Lines changed: 37 additions & 13 deletions

File tree

tests/e2e/features/environment.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -439,12 +439,6 @@ def before_feature(context: Context, feature: Feature) -> None:
439439
switch_config(context.feature_config)
440440
restart_container("lightspeed-stack")
441441

442-
if "InlineRAG" in feature.tags:
443-
context.feature_config = _get_config_path("inline-rag", mode_dir)
444-
context.default_config_backup = create_config_backup("lightspeed-stack.yaml")
445-
switch_config(context.feature_config)
446-
restart_container("lightspeed-stack")
447-
448442
if "MCPFileAuth" in feature.tags:
449443
context.feature_config = _get_config_path("mcp-file-auth", mode_dir)
450444
context.default_config_backup = create_config_backup("lightspeed-stack.yaml")
@@ -479,11 +473,6 @@ def after_feature(context: Context, feature: Feature) -> None:
479473
response = requests.delete(url, timeout=10)
480474
assert response.status_code == 200, f"{url} returned {response.status_code}"
481475

482-
if "InlineRAG" in feature.tags:
483-
switch_config(context.default_config_backup)
484-
restart_container("lightspeed-stack")
485-
remove_config_backup(context.default_config_backup)
486-
487476
if "MCP" in feature.tags:
488477
switch_config(context.default_config_backup)
489478
restart_container("lightspeed-stack")

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 inline RAG 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
"""Implementation of common test steps."""
22

3+
import os
4+
35
from behave import given # pyright: ignore[reportAttributeAccessIssue]
46
from behave.runner import Context
5-
import os
7+
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+
)
615

716

817
@given("The service is started locally")
@@ -22,6 +31,32 @@ def service_is_started_locally(context: Context) -> None:
2231
context.port_llama = os.getenv("E2E_LLAMA_PORT", "8321")
2332

2433

34+
@given("The service uses inline RAG configuration")
35+
def configure_inline_rag(context: Context) -> None:
36+
"""Switch to inline RAG configuration if not already active.
37+
38+
On first call creates a backup of the current config, switches to the
39+
inline-rag 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+
if not is_prow_environment() and os.path.exists("lightspeed-stack.yaml.backup"):
44+
return
45+
46+
mode_dir = "library-mode" if context.is_library_mode else "server-mode"
47+
if is_prow_environment():
48+
config_path = "tests/e2e-prow/rhoai/configs/lightspeed-stack-inline-rag.yaml"
49+
else:
50+
config_path = (
51+
f"tests/e2e/configuration/{mode_dir}/lightspeed-stack-inline-rag.yaml"
52+
)
53+
create_config_backup("lightspeed-stack.yaml")
54+
switch_config(config_path)
55+
restart_container("lightspeed-stack")
56+
# Library mode needs extra time to load embedding models after restart
57+
wait_for_container_health("lightspeed-stack", max_attempts=12)
58+
59+
2560
@given("The system is in default state")
2661
def system_in_default_state(context: Context) -> None:
2762
"""Check the default system state.

0 commit comments

Comments
 (0)