Skip to content

Commit c3a93ce

Browse files
author
Sofiya Nuryyeva
committed
cleaning up any prow related reference, updated e2e testing doc on how to run okp tests locally
1 parent c5c1edd commit c3a93ce

8 files changed

Lines changed: 90 additions & 231 deletions

File tree

.tekton/integration-tests/pipeline/lightspeed-stack-integration-test.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,6 @@ spec:
281281
value: "true"
282282
- name: OTEL_ANONYMIZATION_SECRET
283283
value: "lightspeed-stack-otel-anonymization-dev-default"
284-
# PipelineRun metadata for ownerReference in secret creation
285-
- name: TEKTON_PIPELINERUN_NAME
286-
value: "$(context.pipelineRun.name)"
287-
- name: TEKTON_PIPELINERUN_UID
288-
value: "$(context.pipelineRun.uid)"
289284
image: registry.access.redhat.com/ubi9/ubi-minimal
290285
script: |
291286
set +e

docs/testing/e2e_scenarios.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@
115115
* Check if models can be filtered
116116
* Check if filtering can return empty list of models
117117

118+
## [`okp_rag.feature`](https://github.com/lightspeed-core/lightspeed-stack/blob/main/tests/e2e/features/okp_rag.feature)
119+
120+
Konflux only (`@konflux-only`). Local stack: [Running OKP RAG tests locally](e2e_testing.md#running-okp-rag-tests-locally).
121+
122+
* Offline mode query with inline RAG returns rag_chunks and referenced_documents
123+
* Online mode streaming query with inline RAG returns referenced_documents
124+
* Query with inline RAG with dynamic semantic filter returns rag_chunks and referenced_documents
125+
* Offline query API with OKP tool RAG has rag_chunk and referenced_documents returned
126+
* Online responses API with OKP tool RAG has rag results returned
127+
* Query succeeds with empty rag_chunks when OKP server is unavailable
128+
* Streaming query succeeds with empty referenced_documents when OKP server is unavailable
129+
* Query returns no rag_chunks and no reference_documents when OKP is disabled
130+
* Streaming query returns no referenced_documents when OKP is disabled
131+
118132
## [`proxy.feature`](https://github.com/lightspeed-core/lightspeed-stack/blob/main/tests/e2e/features/proxy.feature)
119133

120134
* LLM traffic is routed through a configured tunnel proxy

docs/testing/e2e_testing.md

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ This guide describes how to run, extend, and understand the Lightspeed Core Stac
99
1. [Overview](#overview)
1010
2. [Directory Layout](#directory-layout)
1111
3. [How to Run E2E Tests](#how-to-run-e2e-tests)
12-
4. [Environment Variables](#environment-variables)
13-
5. [Deployment Modes: Server vs Library](#deployment-modes-server-vs-library)
14-
6. [Tags and Hooks](#tags-and-hooks)
15-
7. [Configuration Files](#configuration-files)
16-
8. [Feature Files and Steps](#feature-files-and-steps)
17-
9. [Gherkin Keywords in Feature Files](#gherkin-keywords-in-feature-files)
18-
10. [Writing New Scenarios](#writing-new-scenarios)
19-
11. [Troubleshooting](#troubleshooting)
12+
4. [Running OKP RAG tests locally](#running-okp-rag-tests-locally)
13+
5. [Environment Variables](#environment-variables)
14+
6. [Deployment Modes: Server vs Library](#deployment-modes-server-vs-library)
15+
7. [Tags and Hooks](#tags-and-hooks)
16+
8. [Configuration Files](#configuration-files)
17+
9. [Feature Files and Steps](#feature-files-and-steps)
18+
10. [Gherkin Keywords in Feature Files](#gherkin-keywords-in-feature-files)
19+
11. [Writing New Scenarios](#writing-new-scenarios)
20+
12. [Troubleshooting](#troubleshooting)
2021

2122
---
2223

@@ -135,6 +136,35 @@ uv run behave tests/e2e/features/health.feature --tags=-skip-in-library-mode
135136

136137
---
137138

139+
## Running OKP RAG tests locally
140+
141+
`okp_rag.feature` is `@konflux-only` (`make test-e2e` skips it). Locally: OKP in Docker, OGX and LCS as host processes. Needs `registry.redhat.io` login, `OPENAI_API_KEY`, and `../lightspeed-providers`. Do not set `E2E_KONFLUX_E2E=1` (that deploys OKP on Kubernetes).
142+
143+
```bash
144+
docker login registry.redhat.io
145+
docker run --rm -d -p 8081:8080 registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
146+
147+
export RH_SERVER_OKP=http://localhost:8081/solr
148+
export PYTHONPATH="$(cd ../lightspeed-providers && pwd)${PYTHONPATH:+:$PYTHONPATH}"
149+
export EXTERNAL_PROVIDERS_DIR="$(cd ../lightspeed-providers && pwd)/resources/external_providers"
150+
OKP_LCS=tests/e2e/configuration/server-mode/lightspeed-stack-okp-offline.yaml
151+
152+
# terminal 1 — OGX :8321
153+
uv run python src/ogx_configuration.py -c "$OKP_LCS" -i run.yaml -o run_enriched.yaml
154+
uv run ogx stack run run_enriched.yaml --port 8321
155+
156+
# terminal 2 — LCS :8080
157+
make run-ogx CONFIG="$OKP_LCS"
158+
159+
curl -sX POST http://localhost:8080/v1/query \
160+
-H "Content-Type: application/json" \
161+
-d '{"query": "configure remote desktop using gnome"}' | jq .
162+
```
163+
164+
Confirm OKP at http://localhost:8081. Other `lightspeed-stack-okp-*.yaml` files cover tool RAG / online URLs (re-enrich and restart OGX). Product setup: [OKP guide](../user_doc/okp_guide.md).
165+
166+
---
167+
138168
## Environment Variables
139169

140170
| Variable | Default | Description |
@@ -150,6 +180,8 @@ uv run behave tests/e2e/features/health.feature --tags=-skip-in-library-mode
150180
| `E2E_DEFAULT_PROVIDER_OVERRIDE` || Override default provider id (e.g. `openai`). |
151181
| `FAISS_VECTOR_STORE_ID` || Vector store id for FAISS-related scenarios. |
152182
| `RUNNING_PROW` || Set in Prow/OpenShift; enables Prow config paths and pod/container ops. |
183+
| `E2E_KONFLUX_E2E` || `1` in Konflux only. Unskips `@konflux-only` and deploys OKP as a pod. |
184+
| `RH_SERVER_OKP` || OKP/Solr URL (local default `http://localhost:8081/solr`). |
153185
| `OPENAI_API_KEY` || **Required.** Used by the app and OGX for LLM calls (e.g. OpenAI). The E2E tests and the stack will not run correctly without it. |
154186

155187

@@ -175,6 +207,8 @@ All tag behaviour is implemented in **`features/environment.py`**: the hooks (`b
175207
| Tag | Effect |
176208
|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
177209
| `@skip` | Scenario is skipped (reason: "Marked with @skip"). Use for broken or WIP scenarios. |
210+
| `@konflux-only` | Skipped unless `E2E_KONFLUX_E2E=1`. Used by `okp_rag.feature`. |
211+
| `@cfg_okp` | OKP Solr RAG. Konflux deploys OKP in `before_feature`. See [Running OKP RAG tests locally](#running-okp-rag-tests-locally). |
178212
| `@skip-in-library-mode` | Scenario is skipped when `E2E_DEPLOYMENT_MODE=library`. Used for tests that require a separate OGX (e.g. connection disruption). |
179213
| `@local` | Skipped unless running in "local" mode (context flag). |
180214
| `@InvalidFeedbackStorageConfig` | Before scenario: switch to invalid-feedback-storage config and restart container. After: restore feature config and restart. |
@@ -245,6 +279,7 @@ The feature files below are run in the order given in `tests/e2e/test_list.txt`:
245279
| `rest_api.feature` | REST API: OpenAPI endpoint. |
246280
| `mcp.feature` | MCP (Model Context Protocol): tools, query, streaming_query with MCP auth (required, token, invalid token). |
247281
| `models.feature` | Models endpoint: list models, filter, empty result; error when OGX unreachable. |
282+
| `okp_rag.feature` | OKP Solr RAG (`@konflux-only`). Local stack: [Running OKP RAG tests locally](#running-okp-rag-tests-locally). |
248283

249284

250285
If you add a new feature file, add it to **`tests/e2e/test_list.txt`** so it is included when you run the full E2E suite (e.g. `make test-e2e`). The order in that file is the run order.
@@ -354,6 +389,6 @@ Here, **Given** sets state, **When** performs the HTTP call, **Then** and **And*
354389
- **Readonly database (SQLite) in OGX**: If the RAG KV DB is on a bind-mounted path that becomes read-only (e.g. after restart), move it to a named volume (e.g. via `KV_RAG_PATH` in docker-compose) so writes succeed.
355390
- **ChunkedEncodingError on streaming_query**: The step for streaming_query uses `stream=True` and consumes the stream; if you add new streaming steps, avoid reading the full response with `response.content` and use the same stream-reading pattern so a server close after an error event does not raise.
356391
- **Event loop is closed (httpx/AsyncClient)**: In E2E, any code that creates an `AsyncOgxClient` (e.g. for shields) must close it (e.g. `await client.close()`) in a `finally` block before the event loop is torn down (e.g. before `asyncio.run()` returns).
357-
- **Scenarios skipped**: Check tags (`@skip`, `@skip-in-library-mode`, `@local`) and `E2E_DEPLOYMENT_MODE`; ensure the scenario is not excluded by `--tags=-skip` (or the opposite if you intend to run only skipped scenarios for debugging).
392+
- **Scenarios skipped**: Check tags (`@skip`, `@skip-in-library-mode`, `@local`, `@konflux-only`) and `E2E_DEPLOYMENT_MODE`; ensure the scenario is not excluded by `--tags=-skip` (or the opposite if you intend to run only skipped scenarios for debugging).
358393

359394
For more on test structure and commands, see the main project guide (`CLAUDE.md`) and `tests/e2e/features/steps/README.md`.

docs/user_doc/okp_guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ validating that queries return referenced chunks.
5454
Start the OKP RAG service with Podman or Docker:
5555

5656
**Using Podman:**
57+
5758
```bash
5859
podman login registry.redhat.io
5960
podman run --rm -d -p 8081:8080 registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
6061
```
6162

6263
**Using Docker:**
64+
6365
```bash
6466
docker login registry.redhat.io
6567
docker run --rm -d -p 8081:8080 registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
@@ -349,4 +351,6 @@ If you see no RAG context, verify:
349351
1. OKP is up at http://localhost:8081
350352
2. `lightspeed-stack.yaml` has `okp` under `rag.inline` and/or `rag.tool` as in Step 4
351353

354+
The Behave suite `okp_rag.feature` (`@cfg_okp`) runs in Konflux only. To stand up the same OKP + OGX + LCS topology on a laptop (OKP in Docker, OGX and LCS as host processes), see [Running OKP RAG tests locally](../testing/e2e_testing.md#running-okp-rag-tests-locally).
355+
352356
---

tests/e2e-prow/rhoai/manifests/lightspeed/ogx-prow.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ spec:
8484
workingDir: /opt/app-root
8585
env:
8686
- name: PYTHONPATH
87-
value: "/opt/app-root:/opt/app-root/src"
88-
- name: EXTERNAL_PROVIDERS_DIR
89-
value: "/opt/app-root/providers.d"
87+
value: "/opt/app-root/src"
9088
- name: HOME
9189
value: "/opt/app-root/src"
9290
# Prevent OGX from shutil.move(~/.llama → ~/.ogx) which would steal the fixture.

tests/e2e-prow/rhoai/pipeline-konflux.sh

Lines changed: 19 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -110,106 +110,42 @@ oc create secret docker-registry quay-lightspeed-pull-secret \
110110
# Link the secret to default service account for image pulls
111111
oc secrets link default quay-lightspeed-pull-secret --for=pull -n "$NAMESPACE" 2>/dev/null || echo "⚠️ Secret already linked to default SA"
112112

113-
# Create Red Hat registry pull secret for OKP images
114-
# Option 1: Use mounted docker-registry secret (preferred - simpler)
113+
# Create Red Hat registry pull secret for OKP images in the ephemeral test
114+
# namespace. Do not set ownerReferences to the Konflux PipelineRun: that object
115+
# lives on a different cluster, and the ephemeral GC would treat the Secret as
116+
# orphaned. Namespace teardown deletes the Secret with everything else.
115117
if [[ -f /var/run/redhat-registry-pull-secret/.dockerconfigjson ]]; then
116118
log "Creating Red Hat registry pull secret from mounted docker-registry secret..."
119+
oc create secret generic redhat-registry-pull-secret \
120+
--from-file=.dockerconfigjson=/var/run/redhat-registry-pull-secret/.dockerconfigjson \
121+
--type=kubernetes.io/dockerconfigjson \
122+
-n "$NAMESPACE" \
123+
--dry-run=client -o yaml | oc apply -f -
124+
log "✅ Red Hat registry pull secret created"
125+
oc secrets link default redhat-registry-pull-secret --for=pull -n "$NAMESPACE" 2>/dev/null || echo "⚠️ Secret already linked to default SA"
117126

118-
DOCKERCONFIG_BASE64=$(cat /var/run/redhat-registry-pull-secret/.dockerconfigjson | base64 -w0)
119-
120-
# Use PipelineRun metadata for ownerReference (provided by Tekton context)
121-
# This ensures automatic cleanup when the PipelineRun completes
122-
if [[ -n "${TEKTON_PIPELINERUN_NAME:-}" && -n "${TEKTON_PIPELINERUN_UID:-}" ]]; then
123-
log "Setting ownerReference to PipelineRun: $TEKTON_PIPELINERUN_NAME (UID: ${TEKTON_PIPELINERUN_UID:0:8}...)"
124-
125-
# Create secret with ownerReference using YAML (ensures automatic cleanup)
126-
cat <<EOF | oc apply -f -
127-
apiVersion: v1
128-
kind: Secret
129-
metadata:
130-
name: redhat-registry-pull-secret
131-
namespace: $NAMESPACE
132-
ownerReferences:
133-
- apiVersion: tekton.dev/v1beta1
134-
kind: PipelineRun
135-
name: $TEKTON_PIPELINERUN_NAME
136-
uid: $TEKTON_PIPELINERUN_UID
137-
controller: false
138-
blockOwnerDeletion: false
139-
type: kubernetes.io/dockerconfigjson
140-
data:
141-
.dockerconfigjson: $DOCKERCONFIG_BASE64
142-
EOF
143-
log "✅ Red Hat registry pull secret created with ownerReference"
144-
145-
# Link to default service account
146-
oc secrets link default redhat-registry-pull-secret --for=pull -n "$NAMESPACE" 2>/dev/null || echo "⚠️ Secret already linked to default SA"
147-
else
148-
# Fallback: create without ownerReference (requires manual cleanup)
149-
log "⚠️ TEKTON_PIPELINERUN_NAME/UID not set - creating secret without ownerReference"
150-
log "⚠️ Manual cleanup required after test completion"
151-
152-
cat <<EOF | oc apply -f -
153-
apiVersion: v1
154-
kind: Secret
155-
metadata:
156-
name: redhat-registry-pull-secret
157-
namespace: $NAMESPACE
158-
type: kubernetes.io/dockerconfigjson
159-
data:
160-
.dockerconfigjson: $DOCKERCONFIG_BASE64
161-
EOF
162-
log "✅ Red Hat registry pull secret created (without ownerReference)"
163-
oc secrets link default redhat-registry-pull-secret --for=pull -n "$NAMESPACE" 2>/dev/null || echo "⚠️ Secret already linked to default SA"
164-
fi
165-
166-
# Option 2: Fallback to username/password mounted separately (legacy approach)
167127
elif [[ -d /var/run/redhat-registry-username ]] && [[ -d /var/run/redhat-registry-password ]]; then
168128
log "Creating Red Hat registry pull secret from username/password..."
169129
REDHAT_USERNAME=""
170130
REDHAT_PASSWORD=""
171131

172-
# Read username
173132
shopt -s nullglob
174133
for _f in /var/run/redhat-registry-username/*; do
175134
[[ -f "$_f" ]] && REDHAT_USERNAME="$(cat "$_f")" && break
176135
done
177-
178-
# Read password
179136
for _f in /var/run/redhat-registry-password/*; do
180137
[[ -f "$_f" ]] && REDHAT_PASSWORD="$(cat "$_f")" && break
181138
done
182139
shopt -u nullglob
183140

184141
if [[ -n "$REDHAT_USERNAME" ]] && [[ -n "$REDHAT_PASSWORD" ]]; then
185-
# Use PipelineRun metadata for ownerReference (provided by Tekton context)
186-
if [[ -n "${TEKTON_PIPELINERUN_NAME:-}" && -n "${TEKTON_PIPELINERUN_UID:-}" ]]; then
187-
log "Setting ownerReference to PipelineRun: $TEKTON_PIPELINERUN_NAME (UID: ${TEKTON_PIPELINERUN_UID:0:8}...)"
188-
189-
# Create secret with ownerReference (oc handles JSON encoding safely)
190-
oc create secret docker-registry redhat-registry-pull-secret \
191-
--docker-server=registry.redhat.io \
192-
--docker-username="$REDHAT_USERNAME" \
193-
--docker-password="$REDHAT_PASSWORD" \
194-
-n "$NAMESPACE" \
195-
--dry-run=client -o json | \
196-
jq --arg name "$TEKTON_PIPELINERUN_NAME" --arg uid "$TEKTON_PIPELINERUN_UID" \
197-
'.metadata.ownerReferences = [{"apiVersion":"tekton.dev/v1beta1","kind":"PipelineRun","name":$name,"uid":$uid,"controller":false,"blockOwnerDeletion":false}]' | \
198-
oc apply -f -
199-
log "✅ Red Hat registry pull secret created with ownerReference"
200-
else
201-
# Fallback: create without ownerReference
202-
log "⚠️ TEKTON_PIPELINERUN_NAME/UID not set - creating secret without ownerReference"
203-
log "⚠️ Manual cleanup required after test completion"
204-
205-
oc create secret docker-registry redhat-registry-pull-secret \
206-
--docker-server=registry.redhat.io \
207-
--docker-username="$REDHAT_USERNAME" \
208-
--docker-password="$REDHAT_PASSWORD" \
209-
-n "$NAMESPACE" 2>/dev/null && log "✅ Red Hat registry pull secret created" || log "⚠️ Secret exists or creation failed"
210-
fi
211-
212-
# Link to default service account
142+
oc create secret docker-registry redhat-registry-pull-secret \
143+
--docker-server=registry.redhat.io \
144+
--docker-username="$REDHAT_USERNAME" \
145+
--docker-password="$REDHAT_PASSWORD" \
146+
-n "$NAMESPACE" \
147+
--dry-run=client -o yaml | oc apply -f -
148+
log "✅ Red Hat registry pull secret created"
213149
oc secrets link default redhat-registry-pull-secret --for=pull -n "$NAMESPACE" 2>/dev/null || echo "⚠️ Secret already linked to default SA"
214150
else
215151
log "⚠️ Red Hat registry credentials not found in /var/run - OKP image pull may fail"
@@ -425,10 +361,8 @@ fi
425361
# Debug hook/port churn: export E2E_OPS_VERBOSE=1 before running pipeline.sh
426362
export E2E_LSC_PORT_FORWARD_PID_FILE="${E2E_LSC_PORT_FORWARD_PID_FILE:-/tmp/e2e-lightspeed-port-forward.pid}"
427363
export E2E_LLAMA_PORT_FORWARD_PID_FILE="${E2E_LLAMA_PORT_FORWARD_PID_FILE:-/tmp/e2e-llama-port-forward.pid}"
428-
export E2E_OKP_PORT_FORWARD_PID_FILE="${E2E_OKP_PORT_FORWARD_PID_FILE:-/tmp/e2e-okp-port-forward.pid}"
429364
rm -f "$E2E_LSC_PORT_FORWARD_PID_FILE"
430365
rm -f "$E2E_LLAMA_PORT_FORWARD_PID_FILE"
431-
rm -f "$E2E_OKP_PORT_FORWARD_PID_FILE"
432366

433367
oc label pod lightspeed-stack-service pod=lightspeed-stack-service -n $NAMESPACE
434368

@@ -449,7 +383,7 @@ kill_listeners_on_ports() {
449383
fi
450384
done
451385
}
452-
kill_listeners_on_ports 8080 8000 8321 8081
386+
kill_listeners_on_ports 8080 8000 8321
453387

454388
# Start port-forward for lightspeed-stack
455389
progress "Starting port-forward, then E2E tests"
@@ -469,9 +403,6 @@ oc port-forward svc/llama-stack-service-svc 8321:8321 -n $NAMESPACE &
469403
PF_LLAMA_PID=$!
470404
echo "$PF_LLAMA_PID" >"$E2E_LLAMA_PORT_FORWARD_PID_FILE"
471405

472-
# OKP Solr port-forward (localhost:8081) is started by e2e-ops deploy-okp-solr
473-
# when okp_rag.feature runs — do not start it here.
474-
475406
# Wait for port-forward to be usable (app may not be listening immediately; port-forward can drop)
476407
log "Waiting for port-forward to lightspeed-stack to be ready..."
477408
for i in $(seq 1 36); do
@@ -581,13 +512,6 @@ if [[ -n "${E2E_LLAMA_PORT_FORWARD_PID_FILE:-}" && -f "$E2E_LLAMA_PORT_FORWARD_P
581512
fi
582513
rm -f "$E2E_LLAMA_PORT_FORWARD_PID_FILE"
583514
fi
584-
if [[ -n "${E2E_OKP_PORT_FORWARD_PID_FILE:-}" && -f "$E2E_OKP_PORT_FORWARD_PID_FILE" ]]; then
585-
read -r _okp_pf <"$E2E_OKP_PORT_FORWARD_PID_FILE" 2>/dev/null || true
586-
if [[ "${_okp_pf:-}" =~ ^[0-9]+$ ]]; then
587-
kill -9 "$_okp_pf" 2>/dev/null || true
588-
fi
589-
rm -f "$E2E_OKP_PORT_FORWARD_PID_FILE"
590-
fi
591515

592516
kill $PF_LCS_PID 2>/dev/null || true
593517
kill $PF_JWKS_PID 2>/dev/null || true

0 commit comments

Comments
 (0)