Add public API smoke tests#44
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new post-deploy, read-only API smoke test suite (GraphQL + REST), its configuration/expectations, test helpers, tests for schema/records/pagination/search/health/stats, docs, a Makefile target, and an unreleased changelog entry. ChangesAPI Smoke Tests
Sequence DiagramsequenceDiagram
participant Runner as Test Runner (make / go test)
participant Smoke as Smoke Tests
participant API as Hyperindex API (GraphQL/REST)
participant Expectations as expectations.json
Runner->>Smoke: invoke (HYPERINDEX_SMOKE_URL, optional expectations)
Smoke->>Expectations: load & validate expectations.json
Smoke->>API: GET /health
API-->>Smoke: 200 + {"status":"ok"}
Smoke->>API: GET /stats
API-->>Smoke: 200 + stats JSON
Smoke->>API: POST /graphql (introspection / records / search)
API-->>Smoke: 200 + GraphQL response
Smoke->>Runner: pass/fail results (exit code, logs)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
|
🚅 Deployed to the hyperindex-pr-44 environment in hyperindex-v2-setup
1 service not affected by this PR
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/api-smoke/config_test.go`:
- Around line 145-175: validate() currently only builds dataBearingNSIDs
(map[string]bool) so the pagination check can't access MinimumRecords; add a
map[string]int (e.g., dataBearingMinRecords) when iterating
e.DataBearingCollections to record each collection.MinimumRecords keyed by
collection.NSID, then in the loop over e.PaginationCollections (using
collection.NSID and collection.PageSize) validate that
dataBearingMinRecords[collection.NSID] >= 2*collection.PageSize and return a
clear fmt.Errorf like "pagination collection %q must have minimumRecords >= 2 *
pageSize" if it doesn't; keep existing checks (NSID non-empty, PageSize > 0,
presence in dataBearingNSIDs) and add this new two-page assertion.
In `@tests/api-smoke/pagination_test.go`:
- Around line 11-36: The test currently enforces a hard-coded
expectedPaginationPageSize (expectedPaginationPageSize = 10) inside
TestPaginationSmoke, which prevents collection-specific pageSize overrides;
remove the constant and the gate that checks collection.PageSize against it, and
instead use collection.PageSize directly in the test's pagination queries and
assertions (e.g., in TestPaginationSmoke and any pagination assertions that
referenced expectedPaginationPageSize), or default to the collection.PageSize
when building the request so per-collection page sizes are honored.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ec8087a8-25d8-435c-aa68-045875618d2d
📒 Files selected for processing (11)
.changes/unreleased/add-api-smoke-tests.yamlMakefiletests/api-smoke/README.mdtests/api-smoke/config_test.gotests/api-smoke/expectations.jsontests/api-smoke/graphql_client_test.gotests/api-smoke/pagination_test.gotests/api-smoke/public_queries_test.gotests/api-smoke/records_test.gotests/api-smoke/rest_test.gotests/api-smoke/schema_test.go
Summary
tests/api-smoke.make smoke-apiwith friendly streamed operator output, debug request logs, and fail-fast URL validation.Validation
go build -v ./...make lintDATABASE_URL=sqlite::memory: go test -v -race ./...make testgo test ./tests/api-smokeHYPERINDEX_SMOKE_URL=http://127.0.0.1:1 go test -tags=api_smoke ./tests/api-smoke -run TestNonExistent -count=1HYPERINDEX_SMOKE_URL=https://dev.api.hi.gainforest.app make smoke-apiHYPERINDEX_SMOKE_DEBUG=1 HYPERINDEX_SMOKE_URL=https://dev.api.hi.gainforest.app make smoke-apiSummary by CodeRabbit
New Features
Documentation
Chores