Skip to content

Commit 09310c1

Browse files
ci(auth): add GitHub Actions workflow for prompts tenant isolation tests (#5758)
## Summary - Add a new GitHub Actions workflow that provisions K8s service account tokens via minikube and runs the prompts tenant isolation integration tests with real `oauth2_token` auth - Tests use Alice/Bob pattern with separate K8s service accounts (`ogx-user1`, `ogx-user2`) to verify cross-tenant data isolation > **Depends on:** #5756 (multi-tenancy core) — merge that PR first, then rebase this one. ## Test plan - [x] Workflow YAML validated locally - [x] Integration test file runs when server is configured with auth (`tests/integration/responses/test_prompts_access_control.py`) - [x] Tests skip gracefully when `ALICE_TOKEN`/`BOB_TOKEN` env vars are not set 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Francisco Javier Arceo <farceo@redhat.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 748cb69 commit 09310c1

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ OGX uses GitHub Actions for Continuous Integration (CI). Below is a table detail
1313
| File Processors Tests | [file-processors-tests.yml](file-processors-tests.yml) | Run file processors integration tests |
1414
| Installer CI | [install-script-ci.yml](install-script-ci.yml) | Test the installation script |
1515
| Integration Auth Tests | [integration-auth-tests.yml](integration-auth-tests.yml) | Run the integration test suite with Kubernetes authentication |
16-
| Integration Responses & Conversations Auth Tests | [integration-responses-conversations-auth-tests.yml](integration-responses-conversations-auth-tests.yml) | Run responses and conversations auth tests with Kubernetes authentication |
16+
| Integration Responses, Conversations & Prompts Auth Tests | [integration-responses-conversations-auth-tests.yml](integration-responses-conversations-auth-tests.yml) | Run responses, conversations, and prompts auth tests with Kubernetes authentication |
1717
| SqlStore Integration Tests | [integration-sql-store-tests.yml](integration-sql-store-tests.yml) | Run the integration test suite with SqlStore |
1818
| Integration Tests (Replay) | [integration-tests.yml](integration-tests.yml) | Run the integration test suites from tests/integration in replay mode |
1919
| Vector IO Integration Tests | [integration-vector-io-tests.yml](integration-vector-io-tests.yml) | Run the integration test suite with various VectorIO providers |

.github/workflows/integration-responses-conversations-auth-tests.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Integration Responses & Conversations Auth Tests
1+
name: Integration Responses, Conversations & Prompts Auth Tests
22

3-
run-name: Run responses and conversations auth tests with Kubernetes authentication
3+
run-name: Run responses, conversations, and prompts auth tests with Kubernetes authentication
44

55
on:
66
push:
@@ -218,6 +218,16 @@ jobs:
218218
when:
219219
- user is owner
220220
description: Users can access their own responses
221+
- permit:
222+
actions: [create]
223+
resource: sql_record::prompts::*
224+
description: Any authenticated user can create prompts
225+
- permit:
226+
actions: [read, update, delete]
227+
resource: sql_record::prompts::*
228+
when:
229+
- user is owner
230+
description: Users can only access their own prompts
221231
EOF
222232
yq eval '.server.auth.provider_config.type = "${{ matrix.auth-provider }}"' -i "$run_dir/config.yaml"
223233
yq eval '.server.auth.provider_config.tls_cafile = "${{ env.KUBERNETES_CA_CERT_PATH }}"' -i "$run_dir/config.yaml"

scripts/integration-responses-conversations-auth-tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ uv run pytest tests/integration/conversations/test_openai_conversations.py \
3232
echo ""
3333
echo "✓ Conversations isolation tests completed successfully!"
3434

35+
echo ""
36+
echo "Running prompts isolation tests..."
37+
38+
uv run pytest tests/integration/responses/test_prompts_access_control.py \
39+
-k "TestPromptsAccessControl" \
40+
--stack-config="$OGX_SERVER_URL" \
41+
-v -s \
42+
--color=yes || exit 1
43+
44+
echo ""
45+
echo "✓ Prompts isolation tests completed successfully!"
46+
3547
# Run responses access control tests if INFERENCE_MODEL is set
3648
# Uses record-if-missing mode: replays from recordings if available, records if API key is set
3749
if [ -n "${INFERENCE_MODEL:-}" ]; then

0 commit comments

Comments
 (0)