Skip to content

Optimize gateway tests#1102

Draft
Tharsanan1 wants to merge 3 commits intowso2:mainfrom
Tharsanan1:optimize-gateway-tests
Draft

Optimize gateway tests#1102
Tharsanan1 wants to merge 3 commits intowso2:mainfrom
Tharsanan1:optimize-gateway-tests

Conversation

@Tharsanan1
Copy link
Contributor

@Tharsanan1 Tharsanan1 commented Feb 12, 2026

Purpose

$subject

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Enhanced error messages to display actual error details instead of generic text, improving troubleshooting experience.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The pull request introduces GitHub Actions matrix strategy for parallel integration testing with Docker build caching optimization, and fixes an error message in the handlers package to display actual error text instead of a hardcoded string.

Changes

Cohort / File(s) Summary
CI/CD Workflow Optimization
.github/workflows/gateway-integration-test.yml
Implemented matrix strategy with 4 test groups, disabled fail-fast for parallel execution, enabled Go caching, optimized Docker mock-server builds to run in parallel, made integration tests group-aware with distinct feature file selections per group, and updated artifact naming to include matrix group identifiers.
Error Message Fix
gateway/gateway-controller/pkg/api/handlers/handlers.go
Corrected GetConfigDump error response to display actual error text via err.Error() instead of static "Failed to retrieve certificates" message.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 In parallel, the tests now run so fast,
Docker caches hold and builders amassed,
Grouped by four, each feature takes its place,
Errors speak their truth with honest grace,
Integration flows at quickened pace! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is largely incomplete, containing only a placeholder purpose section and missing all required sections including Goals, Approach, User stories, Documentation, Automation tests, Security checks, Samples, Related PRs, and Test environment. Fill in all required template sections with detailed explanations of the changes, testing performed, documentation updates, and security verification.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Optimize gateway tests' is only partially related to the changeset, referring mainly to the test workflow optimization but missing the unrelated error message improvement in handlers.go.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Tharsanan1 Tharsanan1 marked this pull request as draft February 12, 2026 06:51
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/gateway-integration-test.yml:
- Around line 41-47: The backgrounded docker builds in the for-loop using the
mocks array may hide failures because a plain wait only returns the last job's
status; update the loop that starts docker build (symbols: mocks array, the for
mock in "${mocks[@]}" loop, docker build) to record each background PID (e.g.,
push $! into a pids array), then iterate over the pids and wait on each PID
individually, checking each exit code and failing the step (exit non-zero) if
any wait returns non-zero so build failures are propagated and the workflow
fails fast.
🧹 Nitpick comments (1)
.github/workflows/gateway-integration-test.yml (1)

49-66: Hardcoded feature file lists will silently exclude newly added tests.

When a new .feature file is added to the repo, it won't be picked up by any group until someone manually updates this case statement. Consider auto-discovering features and splitting them dynamically (e.g., ls features/*.feature | split), or at minimum add a CI check that verifies all .feature files appear in exactly one group.

Comment on lines +41 to +47
mocks=("mock-jwks" "mock-azure-content-safety" "mock-aws-bedrock-guardrail" "mock-embedding-provider" "mock-analytics-collector")
for mock in "${mocks[@]}"; do
echo "Building $mock..."
docker build -t ghcr.io/wso2/api-platform/$mock:latest tests/mock-servers/$mock
docker build -t ghcr.io/wso2/api-platform/$mock:latest tests/mock-servers/$mock &
done
wait
echo "All mock images built."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Backgrounded build failures may be silently ignored.

Bash wait with no arguments returns the exit status of the last process waited for. If an earlier docker build fails but a later one succeeds, the step will pass and the missing image will cause a confusing failure later during tests.

Capture PIDs and check each exit code:

🐛 Proposed fix to propagate build failures
          mocks=("mock-jwks" "mock-azure-content-safety" "mock-aws-bedrock-guardrail" "mock-embedding-provider" "mock-analytics-collector")
+         pids=()
          for mock in "${mocks[@]}"; do
            echo "Building $mock..."
            docker build -t ghcr.io/wso2/api-platform/$mock:latest tests/mock-servers/$mock &
+           pids+=($!)
          done
-         wait
+         failed=0
+         for pid in "${pids[@]}"; do
+           wait "$pid" || failed=1
+         done
+         if [ "$failed" -ne 0 ]; then
+           echo "One or more mock image builds failed."
+           exit 1
+         fi
          echo "All mock images built."
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mocks=("mock-jwks" "mock-azure-content-safety" "mock-aws-bedrock-guardrail" "mock-embedding-provider" "mock-analytics-collector")
for mock in "${mocks[@]}"; do
echo "Building $mock..."
docker build -t ghcr.io/wso2/api-platform/$mock:latest tests/mock-servers/$mock
docker build -t ghcr.io/wso2/api-platform/$mock:latest tests/mock-servers/$mock &
done
wait
echo "All mock images built."
mocks=("mock-jwks" "mock-azure-content-safety" "mock-aws-bedrock-guardrail" "mock-embedding-provider" "mock-analytics-collector")
pids=()
for mock in "${mocks[@]}"; do
echo "Building $mock..."
docker build -t ghcr.io/wso2/api-platform/$mock:latest tests/mock-servers/$mock &
pids+=($!)
done
failed=0
for pid in "${pids[@]}"; do
wait "$pid" || failed=1
done
if [ "$failed" -ne 0 ]; then
echo "One or more mock image builds failed."
exit 1
fi
echo "All mock images built."
🤖 Prompt for AI Agents
In @.github/workflows/gateway-integration-test.yml around lines 41 - 47, The
backgrounded docker builds in the for-loop using the mocks array may hide
failures because a plain wait only returns the last job's status; update the
loop that starts docker build (symbols: mocks array, the for mock in
"${mocks[@]}" loop, docker build) to record each background PID (e.g., push $!
into a pids array), then iterate over the pids and wait on each PID
individually, checking each exit code and failing the step (exit non-zero) if
any wait returns non-zero so build failures are propagated and the workflow
fails fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant