Skip to content

Commit c3a0e0c

Browse files
committed
(lcore-1251) added tls e2e tests
(lcore-1251) fixed tls tests & removed other e2e tests for quicker test running (lcore-1251) restored test_list.txt (lcore-1251) use `trustme` for certs (lcore-1251) quick tls server fix (lcore-1251) removed tags in place of steps (fix) removed unused code fix tls config verified correct llm response clean
1 parent e184541 commit c3a0e0c

12 files changed

Lines changed: 684 additions & 1 deletion

File tree

docker-compose-library.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ services:
3030
condition: service_healthy
3131
mock-mcp:
3232
condition: service_healthy
33+
mock-tls-inference:
34+
condition: service_healthy
3335
networks:
3436
- lightspeednet
3537
volumes:
@@ -40,6 +42,7 @@ services:
4042
- ./tests/e2e/rag:/opt/app-root/src/.llama/storage/rag:Z
4143
- ./tests/e2e/secrets/mcp-token:/tmp/mcp-token:ro
4244
- ./tests/e2e/secrets/invalid-mcp-token:/tmp/invalid-mcp-token:ro
45+
- mock-tls-certs:/certs:ro
4346
environment:
4447
# LLM Provider API Keys
4548
- BRAVE_SEARCH_API_KEY=${BRAVE_SEARCH_API_KEY:-}
@@ -113,7 +116,30 @@ services:
113116
retries: 3
114117
start_period: 2s
115118

119+
# Mock TLS inference server for TLS E2E tests
120+
mock-tls-inference:
121+
build:
122+
context: ./tests/e2e/mock_tls_inference_server
123+
dockerfile: Dockerfile
124+
container_name: mock-tls-inference
125+
ports:
126+
- "8443:8443"
127+
- "8444:8444"
128+
networks:
129+
- lightspeednet
130+
volumes:
131+
- mock-tls-certs:/certs
132+
healthcheck:
133+
test: ["CMD", "python", "-c", "import urllib.request,ssl;c=ssl.create_default_context();c.check_hostname=False;c.verify_mode=ssl.CERT_NONE;urllib.request.urlopen('https://localhost:8443/health',context=c)"]
134+
interval: 5s
135+
timeout: 3s
136+
retries: 3
137+
start_period: 5s
138+
116139

117140
networks:
118141
lightspeednet:
119-
driver: bridge
142+
driver: bridge
143+
144+
volumes:
145+
mock-tls-certs:

docker-compose.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ services:
2525
container_name: llama-stack
2626
ports:
2727
- "8321:8321" # Expose llama-stack on 8321 (adjust if needed)
28+
depends_on:
29+
mock-tls-inference:
30+
condition: service_healthy
2831
volumes:
2932
- ./run.yaml:/opt/app-root/run.yaml:z
3033
- ${GCP_KEYS_PATH:-./tmp/.gcp-keys-dummy}:/opt/app-root/.gcp-keys:ro
3134
- ./lightspeed-stack.yaml:/opt/app-root/lightspeed-stack.yaml:ro
3235
- llama-storage:/opt/app-root/src/.llama/storage
3336
- ./tests/e2e/rag:/opt/app-root/src/.llama/storage/rag:z
37+
- mock-tls-certs:/certs:ro
3438
environment:
3539
- BRAVE_SEARCH_API_KEY=${BRAVE_SEARCH_API_KEY:-}
3640
- TAVILY_SEARCH_API_KEY=${TAVILY_SEARCH_API_KEY:-}
@@ -140,9 +144,30 @@ services:
140144
retries: 3
141145
start_period: 2s
142146

147+
# Mock TLS inference server for TLS E2E tests
148+
mock-tls-inference:
149+
build:
150+
context: ./tests/e2e/mock_tls_inference_server
151+
dockerfile: Dockerfile
152+
container_name: mock-tls-inference
153+
ports:
154+
- "8443:8443"
155+
- "8444:8444"
156+
networks:
157+
- lightspeednet
158+
volumes:
159+
- mock-tls-certs:/certs
160+
healthcheck:
161+
test: ["CMD", "python", "-c", "import urllib.request,ssl;c=ssl.create_default_context();c.check_hostname=False;c.verify_mode=ssl.CERT_NONE;urllib.request.urlopen('https://localhost:8443/health',context=c)"]
162+
interval: 5s
163+
timeout: 3s
164+
retries: 3
165+
start_period: 5s
166+
143167

144168
volumes:
145169
llama-storage:
170+
mock-tls-certs:
146171

147172
networks:
148173
lightspeednet:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ dev = [
126126
"ruff>=0.11.13",
127127
"aiosqlite",
128128
"behave>=1.3.0",
129+
"trustme>=1.2.1",
129130
"types-cachetools>=6.1.0.20250717",
130131
"build>=1.2.2.post1",
131132
"twine>=6.1.0",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lightspeed Core Service (LCS)
2+
service:
3+
host: 0.0.0.0
4+
port: 8080
5+
auth_enabled: false
6+
workers: 1
7+
color_log: true
8+
access_log: true
9+
llama_stack:
10+
use_as_library_client: true
11+
library_client_config_path: run.yaml
12+
user_data_collection:
13+
feedback_enabled: true
14+
feedback_storage: "/tmp/data/feedback"
15+
transcripts_enabled: true
16+
transcripts_storage: "/tmp/data/transcripts"
17+
authentication:
18+
module: "noop"
19+
inference:
20+
default_provider: tls-openai
21+
default_model: mock-tls-model
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Lightspeed Core Service (LCS)
2+
service:
3+
host: 0.0.0.0
4+
port: 8080
5+
auth_enabled: false
6+
workers: 1
7+
color_log: true
8+
access_log: true
9+
llama_stack:
10+
use_as_library_client: false
11+
url: http://llama-stack:8321
12+
api_key: xyzzy
13+
user_data_collection:
14+
feedback_enabled: true
15+
feedback_storage: "/tmp/data/feedback"
16+
transcripts_enabled: true
17+
transcripts_storage: "/tmp/data/transcripts"
18+
authentication:
19+
module: "noop"
20+
inference:
21+
default_provider: tls-openai
22+
default_model: mock-tls-model

tests/e2e/features/environment.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,14 @@ def before_feature(context: Context, feature: Feature) -> None:
499499
switch_config(context.feature_config)
500500
restart_container("lightspeed-stack")
501501

502+
if "TLS" in feature.tags:
503+
mode_dir = "library-mode" if context.is_library_mode else "server-mode"
504+
context.feature_config = (
505+
f"tests/e2e/configuration/{mode_dir}/lightspeed-stack-tls.yaml"
506+
)
507+
context.default_config_backup = create_config_backup("lightspeed-stack.yaml")
508+
switch_config(context.feature_config)
509+
502510

503511
def after_feature(context: Context, feature: Feature) -> None:
504512
"""Run after each feature file is exercised.
@@ -546,3 +554,10 @@ def after_feature(context: Context, feature: Feature) -> None:
546554
switch_config(context.default_config_backup)
547555
restart_container("lightspeed-stack")
548556
remove_config_backup(context.default_config_backup)
557+
558+
if "TLS" in feature.tags:
559+
switch_config(context.default_config_backup)
560+
remove_config_backup(context.default_config_backup)
561+
if not context.is_library_mode:
562+
restart_container("llama-stack")
563+
restart_container("lightspeed-stack")

0 commit comments

Comments
 (0)