test(it): add template rendering IT coverage for LlmProvider, LlmProxy, Mcp#1829
test(it): add template rendering IT coverage for LlmProvider, LlmProxy, Mcp#1829renuka-fernando wants to merge 1 commit intowso2:mainfrom
Conversation
…y, Mcp
Extend template-rendering integration tests beyond RestApi to cover LlmProvider,
LlmProxy, and Mcp. Each scenario validates the render contract: API responses and
DB storage preserve unrendered template expressions ({{ secret }}, {{ env }},
{{ default }}), while runtime invocation receives resolved values.
- Add generic DB assertion step `the stored <Kind> configuration for "X" should contain:`
backed by kind→table mapping in steps_template.go
- Refactor GetStoredRestAPISourceConfigurationWithRetry to delegate to new
GetStoredSourceConfigurationWithRetry(ctx, kind, table, handle)
- LlmProvider scenario: {{ secret }} in upstream auth header; verify echoed value
- LlmProxy scenario: {{ secret }} in set-headers policy; verify echoed header
- Mcp scenario: {{ env | default }} in upstream URL; verify tools/call invocation
📝 WalkthroughTemplate Rendering Integration Test Coverage ExtensionThis PR extends template-rendering integration test coverage to include Key ChangesTest Scenarios (
Generic DB Assertion Step (
Refactored DB Helper (
WalkthroughThis pull request generalizes template configuration handling across multiple artifact kinds. The database helper function 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.11.4)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies" 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
gateway/it/steps_template.go (1)
48-59: ⚡ Quick winKeep supported artifact kinds in one source of truth.
The supported-kind list is currently repeated in the step regex,
kindTables, and the error string. Consider deriving the regex and supported-kinds message fromkindTablesto avoid drift when adding/removing kinds.Also applies to: 101-104
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@gateway/it/steps_template.go` around lines 48 - 59, The step definition hardcodes the supported kinds in the regex and error messages; instead derive them from the kindTables map so there is a single source of truth. Change the ctx.Step registration that invokes storedConfigurationShouldContain to build its allowed-kind pattern from the keys of kindTables (e.g., join keys with |) or make the regex accept any kind and validate inside storedConfigurationShouldContain against kindTables; also replace any error message that lists supported kinds to generate that message from kindTables keys so additions/removals only need to change kindTables.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@gateway/it/steps_template.go`:
- Around line 48-59: The step definition hardcodes the supported kinds in the
regex and error messages; instead derive them from the kindTables map so there
is a single source of truth. Change the ctx.Step registration that invokes
storedConfigurationShouldContain to build its allowed-kind pattern from the keys
of kindTables (e.g., join keys with |) or make the regex accept any kind and
validate inside storedConfigurationShouldContain against kindTables; also
replace any error message that lists supported kinds to generate that message
from kindTables keys so additions/removals only need to change kindTables.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2d2a91c6-1e6e-4471-851f-5e12c0fcdb0d
📒 Files selected for processing (3)
gateway/it/db_helpers.gogateway/it/features/template-functions.featuregateway/it/steps_template.go
Purpose
Extend template-rendering integration tests beyond RestApi to cover LlmProvider, LlmProxy, and Mcp. Each scenario validates the render contract: API responses and DB storage preserve unrendered template expressions ({{ secret }}, {{ env }}, {{ default }}), while runtime invocation receives resolved values.
the stored <Kind> configuration for "X" should contain:backed by kind→table mapping in steps_template.go