forked from lightspeed-core/lightspeed-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllama_stack_disrupted.feature
More file actions
243 lines (221 loc) · 11.9 KB
/
Copy pathllama_stack_disrupted.feature
File metadata and controls
243 lines (221 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
@e2e_group_3 @skip-in-library-mode @Authorized
Feature: Llama Stack connection disrupted
End-to-end scenarios that stop the Llama Stack container (or simulate disconnect) and
assert degraded responses (503, readiness, etc.). Config order matches test_list.txt:
default stack, then noop-token (query/conversations/…), then rbac (rlsapi errors), then
mcp (immediately before mcp.feature). Skipped in library mode.
Background:
Given The service is started locally
And The system is in default state
And REST API service prefix is /v1
And the Lightspeed stack configuration directory is "tests/e2e/configuration"
# --- lightspeed-stack.yaml (aligned with health, info, models, …) ---
Scenario: Check if models endpoint reports error when llama-stack is unreachable
Given The service uses the lightspeed-stack.yaml configuration
And The service is restarted
Given The system is in default state
And The llama-stack connection is disrupted
When I access REST API endpoint "models" using HTTP GET method
Then The status code of the response is 503
And The body of the response is the following
"""
{"detail": {"response": "Unable to connect to Llama Stack", "cause": "Connection error."}}
"""
Scenario: Check if service report proper readiness state when llama stack is not available
Given The service uses the lightspeed-stack.yaml configuration
And The service is restarted
Given The system is in default state
And The llama-stack connection is disrupted
When I access endpoint "readiness" using HTTP GET method
Then The status code of the response is 503
And The body of the response, ignoring the "providers" field, is the following
"""
{"ready": false, "reason": "Providers not healthy: unknown"}
"""
Scenario: Check if service report proper liveness state even when llama stack is not available
Given The service uses the lightspeed-stack.yaml configuration
And The service is restarted
Given The system is in default state
And The llama-stack connection is disrupted
When I access endpoint "liveness" using HTTP GET method
Then The status code of the response is 200
And The body of the response is the following
"""
{"alive": true}
"""
Scenario: Check if info endpoint reports error when llama-stack connection is not working
Given The service uses the lightspeed-stack.yaml configuration
And The service is restarted
And The llama-stack connection is disrupted
When I access REST API endpoint "info" using HTTP GET method
Then The status code of the response is 503
And The body of the response is the following
"""
{"detail": {"response": "Unable to connect to Llama Stack", "cause": "Connection error."}}
"""
Scenario: Check if shields endpoint reports error when llama-stack is unreachable
Given The service uses the lightspeed-stack.yaml configuration
And The service is restarted
And The llama-stack connection is disrupted
When I access REST API endpoint "shields" using HTTP GET method
Then The status code of the response is 503
And The body of the response is the following
"""
{"detail": {"response": "Unable to connect to Llama Stack", "cause": "Connection error."}}
"""
Scenario: Check if tools endpoint reports error when llama-stack is unreachable
Given The service uses the lightspeed-stack.yaml configuration
And The service is restarted
And The llama-stack connection is disrupted
When I access REST API endpoint "tools" using HTTP GET method
Then The status code of the response is 503
And The body of the response is the following
"""
{"detail": {"response": "Unable to connect to Llama Stack", "cause": "Connection error."}}
"""
# --- lightspeed-stack-auth-noop-token.yaml (aligned with query, responses, conversations, …) ---
Scenario: Check if LLM responds for query request with error for inability to connect to llama-stack
Given Llama Stack is restarted
And The service uses the lightspeed-stack-auth-noop-token.yaml configuration
And The service is restarted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And The llama-stack connection is disrupted
When I use "query" to ask question with authorization header
"""
{"query": "Say hello"}
"""
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack
Scenario: Responses returns error when unable to connect to llama-stack
Given The service uses the lightspeed-stack-auth-noop-token.yaml configuration
And The service is restarted
Given The system is in default state
And The llama-stack connection is disrupted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I use "responses" to ask question with authorization header
"""
{"input": "Say hello", "model": "{PROVIDER}/{MODEL}", "stream": false}
"""
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack
Scenario: Streaming responses returns error when unable to connect to llama-stack
Given The service uses the lightspeed-stack-auth-noop-token.yaml configuration
And The service is restarted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And The llama-stack connection is disrupted
When I use "responses" to ask question with authorization header
"""
{"input": "Say hello", "model": "{PROVIDER}/{MODEL}", "stream": true}
"""
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack
Scenario: Check if rags endpoint fails when llama-stack is unavailable
Given The service uses the lightspeed-stack-auth-noop-token.yaml configuration
And The service is restarted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And The llama-stack connection is disrupted
When I access REST API endpoint rags using HTTP GET method
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack
Scenario: Check if conversations/{conversation_id} GET endpoint fails when llama-stack is unavailable
Given Llama Stack is restarted
And The service uses the lightspeed-stack-auth-noop-token.yaml configuration
And The service is restarted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
And The status code of the response is 200
And I store conversation details
And The llama-stack connection is disrupted
When I use REST API conversation endpoint with conversation_id from above using HTTP GET method
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack
Scenario: Check if conversations/{conversation_id} DELETE endpoint fails when llama-stack is unavailable
Given Llama Stack is restarted
And The service uses the lightspeed-stack-auth-noop-token.yaml configuration
And The service is restarted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And I use "query" to ask question with authorization header
"""
{"query": "Say hello", "model": "{MODEL}", "provider": "{PROVIDER}"}
"""
And The status code of the response is 200
And I store conversation details
And The llama-stack connection is disrupted
When I use REST API conversation endpoint with conversation_id from above using HTTP DELETE method
Then The status code of the response is 503
And The body of the response contains Unable to connect to Llama Stack
Scenario: Check conversations/{conversation_id} works when llama-stack is down
Given Llama Stack is restarted
And The service uses the lightspeed-stack-auth-noop-token.yaml configuration
And The service is restarted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And REST API service prefix is /v1
And I use "query" to ask question with authorization header
"""
{"query": "What is OpenShift?", "model": "{MODEL}", "provider": "{PROVIDER}", "no_tools": true}
"""
And The status code of the response is 200
And I store conversation details
And The llama-stack connection is disrupted
And REST API service prefix is /v2
When I access REST API endpoint "conversations" using HTTP GET method
Then The status code of the response is 200
When I use REST API conversation endpoint with conversation_id from above using HTTP GET method
Then The status code of the response is 200
And The conversation history contains 1 messages
And The conversation history has correct metadata
And The conversation uses model {MODEL} and provider {PROVIDER}
Scenario: V2 conversations DELETE endpoint works even when llama-stack is down
Given Llama Stack is restarted
And The service uses the lightspeed-stack-auth-noop-token.yaml configuration
And The service is restarted
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
And REST API service prefix is /v1
And I use "query" to ask question with authorization header
"""
{"query": "Test resilience", "model": "{MODEL}", "provider": "{PROVIDER}", "no_tools": true}
"""
And The status code of the response is 200
And I store conversation details
And The llama-stack connection is disrupted
And REST API service prefix is /v2
When I use REST API conversation endpoint with conversation_id from above using HTTP DELETE method
Then The status code of the response is 200
And The returned conversation details have expected conversation_id
And The body of the response, ignoring the "conversation_id" field, is the following
"""
{"success": true, "response": "Conversation deleted successfully"}
"""
When I use REST API conversation endpoint with conversation_id from above using HTTP GET method
Then The status code of the response is 404
And The body of the response contains Conversation not found
# --- lightspeed-stack-rbac.yaml (aligned with rbac.feature / rlsapi_v1_errors.feature) ---
@RBAC
Scenario: Returns 503 when llama-stack connection is broken
Given Llama Stack is restarted
And The service uses the lightspeed-stack-rbac.yaml configuration
And The service is restarted
And I authenticate as "user" user
And The llama-stack connection is disrupted
When I use "infer" to ask question with authorization header
"""
{"question": "How do I list files?"}
"""
Then The status code of the response is 503
And The body of the response contains Llama Stack
# --- lightspeed-stack-mcp.yaml (aligned with mcp.feature / mcp_servers_api.feature next in test_list) ---
@MCP
Scenario: Register MCP server returns 503 when Llama Stack is unreachable
Given Llama Stack is restarted
And The service uses the lightspeed-stack-mcp.yaml configuration
And The service is restarted
And The llama-stack connection is disrupted
When I access REST API endpoint "mcp-servers" using HTTP POST method
"""
{"name": "unreachable-server", "url": "http://mock-mcp:3001", "provider_id": "model-context-protocol"}
"""
Then The status code of the response is 503
And The body of the response contains Llama Stack