-
Notifications
You must be signed in to change notification settings - Fork 632
UN-3636 [MISC] Make the rig unit/integration CI job green on main #2115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,271
−1,485
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
bdfb375
UN-3632 [FIX] Scope rig --fail-on-critical-gap to in-tier coverage so…
chandrasekharan-zipstack 54203db
test: prune dead rig groups/paths, park deprecated services, wire bac…
chandrasekharan-zipstack 8f2db83
fix: make rig editable-install survive uv run re-sync; drop phantom D…
chandrasekharan-zipstack af0af8e
test: make unit-backend collect + run django_db tests in the rig
chandrasekharan-zipstack 7aff271
test: fix two pre-existing backend test bugs exposed by the rig
chandrasekharan-zipstack a75f0e3
test: gate live connector integration tests behind credential env vars
chandrasekharan-zipstack 443cbe1
test: make unit-core and unit-connectors required rig groups
chandrasekharan-zipstack aa11380
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9e04f44
test: address PR review feedback on rig + connector test guards
chandrasekharan-zipstack 674fe8a
test: provision infra for integration tier; split DB/credential tests…
chandrasekharan-zipstack 327b68e
test: address PR review — wire provisioned Redis, mark http_fs integr…
chandrasekharan-zipstack 2f5784f
test: use hostname not literal IP in redis-wiring test (Sonar hotspot)
chandrasekharan-zipstack c214d34
test: mark local testcontainers MinIO http endpoint NOSONAR
chandrasekharan-zipstack da48e89
test: stub UserDefaultAdapter so prompt-studio build-index tests run
chandrasekharan-zipstack 58a96ab
test: drop prompt-service from test compose overlay
chandrasekharan-zipstack 56d151e
test: remove dead S3 smoke test and strip print() debug from connecto…
chandrasekharan-zipstack 7d17ba9
test: switch unit-backend to marker-based selection; classify integra…
chandrasekharan-zipstack 6d61a56
test: centralize DB-test marking; cover adapter-register-llm via inte…
chandrasekharan-zipstack 6c1a9e3
test: complete DB-test centralization; move DB-writer tests to integr…
chandrasekharan-zipstack 1cc8286
test: switch integration-backend to marker-only selection; drop dead …
chandrasekharan-zipstack 337dd34
docs: concise backend test-contribution steps in tests/README.md
chandrasekharan-zipstack 446d5d4
Merge remote-tracking branch 'origin/main' into feat/rig-integration-…
chandrasekharan-zipstack c9eae7c
test: rewrite deployment_helper staging tests with patch.object
chandrasekharan-zipstack 9a76a74
test: drop sys.modules stub ceremony from build-index tests; subproce…
chandrasekharan-zipstack cbbb780
ci: move path filtering from trigger to job level for required-check …
chandrasekharan-zipstack 913379a
test: standardize pytest python_files across services; drop no-flask …
chandrasekharan-zipstack 437d5b0
test: collect Django per-app tests.py files
chandrasekharan-zipstack 98e9da4
ci: run unit and integration tiers as parallel jobs
chandrasekharan-zipstack 7ca9298
ci: make report job propagate tier failures
chandrasekharan-zipstack c17efc1
chore: tighten comments added in this PR
chandrasekharan-zipstack d437e71
ci: enforce --fail-on-critical-gap on PRs too
chandrasekharan-zipstack f7bdd06
ci: run tests on PRs against any base branch
chandrasekharan-zipstack c9ac28e
ci: tighten workflow comments; drop comment on removed trigger filter
chandrasekharan-zipstack 3b56a71
test: add per-test critical-path marker proof; stop 'empty' attesting…
chandrasekharan-zipstack 47a5112
test: restore mock-only connector tests + error-path test; fail repor…
chandrasekharan-zipstack 7212b13
refactor: address SonarCloud issues on rig code
chandrasekharan-zipstack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| """Critical path ``adapter-register-llm``: POST /api/v1/adapter/ registers an | ||
| LLM adapter. Exercises the real endpoint wiring — auth, serializer, metadata | ||
| encryption, org-scoped persistence — with only the SDK context-window lookup | ||
| (a provider-shaped call) mocked. Needs a live DB (integration tier). | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import secrets | ||
| from unittest.mock import patch | ||
|
|
||
| import pytest | ||
| from account_v2.models import Organization, User | ||
| from django.test import TestCase | ||
|
chandrasekharan-zipstack marked this conversation as resolved.
|
||
| from rest_framework import status | ||
| from rest_framework.test import APIRequestFactory, force_authenticate | ||
| from tenant_account_v2.models import OrganizationMember | ||
| from utils.user_context import UserContext | ||
|
|
||
| from adapter_processor_v2.models import AdapterInstance | ||
| from adapter_processor_v2.views import AdapterInstanceViewSet | ||
|
|
||
|
|
||
| class AdapterRegisterLLMAPITest(TestCase): | ||
| def setUp(self) -> None: | ||
| self.org = Organization.objects.create( | ||
| name="org-a", display_name="Org A", organization_id="org-a" | ||
| ) | ||
| UserContext.set_organization_identifier(self.org.organization_id) | ||
| self.user = User.objects.create_user( | ||
| username="owner@example.com", | ||
| email="owner@example.com", | ||
| password=secrets.token_urlsafe(), | ||
| ) | ||
| OrganizationMember.objects.create( | ||
| organization=self.org, user=self.user, role="user" | ||
| ) | ||
| self.create_view = AdapterInstanceViewSet.as_view({"post": "create"}) | ||
|
|
||
| @pytest.mark.critical_path("adapter-register-llm") | ||
| @patch.object(AdapterInstance, "get_context_window_size", return_value=4096) | ||
| def test_register_llm_adapter_persists_encrypted(self, _ctx_window) -> None: | ||
| payload = { | ||
| "adapter_id": "openai|test-llm", | ||
| "adapter_name": "my-openai", | ||
| "adapter_type": "LLM", | ||
| "adapter_metadata": {"api_key": "sk-test", "model": "gpt-4o-mini"}, | ||
| } | ||
| request = APIRequestFactory().post("/api/v1/adapter/", payload, format="json") | ||
| force_authenticate(request, user=self.user) | ||
|
|
||
| response = self.create_view(request) | ||
|
|
||
| assert response.status_code == status.HTTP_201_CREATED, response.data | ||
| instance = AdapterInstance.objects.get(adapter_name="my-openai") | ||
| # persisted under the request user's org, created_by the request user | ||
| assert instance.organization_id == self.org.id | ||
| assert instance.created_by == self.user | ||
| # metadata stored encrypted (binary), decrypts back via .metadata | ||
| assert instance.adapter_metadata_b is not None | ||
| assert instance.metadata["model"] == "gpt-4o-mini" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.