Add integration test: MCPAssociatedAPIResourceUpdateTestCase#14232
Add integration test: MCPAssociatedAPIResourceUpdateTestCase#14232kavindasr wants to merge 2 commits into
Conversation
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a TestNG integration test for MCP-associated API resource updates, including API creation, MCP server generation, resource addition verification, and rejection of removing the MCP-mapped resource. The test is registered in the backend TestNG suite. ChangesMCP Resource Update Integration Test
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
all-in-one-apim/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/mcp/MCPAssociatedAPIResourceUpdateTestCase.java (1)
196-200: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winReplace the fixed sleep with a bounded retry on
/res2.
waitForAPIDeploymentSync(..., IS_API_EXISTS)can return before the newly deployed revision is the active one, and the extraThread.sleep(5000)just makes this test timing-sensitive in slower CI. Polling/res2until it returns 200 without900906would make the assertion both revision-aware and less flaky. Based on learnings,waitForAPIDeploymentSync(..., IS_API_EXISTS)only proves that some revision exists, not that the new one is active.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@all-in-one-apim/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/mcp/MCPAssociatedAPIResourceUpdateTestCase.java` around lines 196 - 200, The test still relies on a fixed sleep after createAPIRevisionAndDeployUsingRest and waitForAPIDeploymentSync(..., APIMIntegrationConstants.IS_API_EXISTS), but that only proves an API exists, not that the newly deployed revision is active. Replace the Thread.sleep(WAIT_FOR_DEPLOYMENT_IN_MILLISECONDS) in MCPAssociatedAPIResourceUpdateTestCase with a bounded retry that repeatedly calls the /res2 endpoint until it returns HTTP 200 and no 900906 error, using the existing API deployment/rest client helpers to keep the assertion revision-aware and less flaky.Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@all-in-one-apim/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/mcp/MCPAssociatedAPIResourceUpdateTestCase.java`:
- Around line 258-274: Teardown in this test should be best-effort and not let
subscription/application cleanup failures skip MCP/API deletion. Update the
cleanup block in MCPAssociatedAPIResourceUpdateTestCase to catch and continue
past exceptions around restAPIStore.removeSubscription and
restAPIStore.deleteApplication, while still attempting
restAPIPublisher.deleteMCPServer and restAPIPublisher.deleteAPI. Also,
explicitly assert the result of restAPIPublisher.deleteMCPServer(...) is
non-null so MCP server deletion failure is detected, since deleteMCPServer only
returns a non-null response on HTTP 200.
---
Nitpick comments:
In
`@all-in-one-apim/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/mcp/MCPAssociatedAPIResourceUpdateTestCase.java`:
- Around line 196-200: The test still relies on a fixed sleep after
createAPIRevisionAndDeployUsingRest and waitForAPIDeploymentSync(...,
APIMIntegrationConstants.IS_API_EXISTS), but that only proves an API exists, not
that the newly deployed revision is active. Replace the
Thread.sleep(WAIT_FOR_DEPLOYMENT_IN_MILLISECONDS) in
MCPAssociatedAPIResourceUpdateTestCase with a bounded retry that repeatedly
calls the /res2 endpoint until it returns HTTP 200 and no 900906 error, using
the existing API deployment/rest client helpers to keep the assertion
revision-aware and less flaky.
🪄 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: e82600e6-3067-4930-a6da-b9dd79337f16
📒 Files selected for processing (2)
all-in-one-apim/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/mcp/MCPAssociatedAPIResourceUpdateTestCase.javaall-in-one-apim/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
Purpose
Related to: wso2/api-manager#5110
Carbon-apimgt PR: wso2/carbon-apimgt#13891