feat: Add integration test: Capabilities reconnect after router restart#85
feat: Add integration test: Capabilities reconnect after router restart#85matheusandre1 wants to merge 3 commits into
Conversation
|
Hi @matheusandre1 I can see that your branch is behind main. Can you please rebase it? Here are a few things I noticed during the review:
Regarding smaller test size, I think we can reduce it little bit by putting #all cleaning methods to CrossCapabilityTestBase. Also, the test could be split into separate test methods, like this: to make it more readable. The test scenario itself is great and we definitely need reconnection testing! Thank you @matheusandre1! |
|
Thanks for feedback, That's pretty self-explanatory, I'll adjust that this week. |
|
Hi @matheusandre1 because PR is Draft, I've just noticed that it was changed. PR is almost perfect now. For me it fails because keycloak configuration (wanaku-realm.json) is missing in the new module. Put please those 2 files (wanaku-realm.json and logback-test.xml) in the new module. Also I think PR need to be changed little bit to follow those changes #91 and it also needs to be rebased one more time. And test could be merged after that. So you can change the status from Draft to Open. Thank you for the contribution! It's a really needed one ;) |
Reviewer's GuideAdds a new cross-capability test module that verifies HTTP, file, and Camel capabilities automatically reconnect to the Wanaku router after a router restart, and updates documentation to describe the new tests and infrastructure. Sequence diagram for router restart and capabilities reconnection testsequenceDiagram
participant JUnitRunner
participant RouterReconnectionITCase
participant CrossCapabilityTestBase
participant WanakuRouter
participant HttpCapability
participant ResourceCapability
participant CamelCapability
JUnitRunner->>RouterReconnectionITCase: runTests()
RouterReconnectionITCase->>CrossCapabilityTestBase: setUpEnvironment()
CrossCapabilityTestBase->>WanakuRouter: startRouter()
CrossCapabilityTestBase->>HttpCapability: connectToRouter()
CrossCapabilityTestBase->>ResourceCapability: connectToRouter()
CrossCapabilityTestBase->>CamelCapability: connectToRouter()
RouterReconnectionITCase->>HttpCapability: verifyInitialHttpToolInvocation()
RouterReconnectionITCase->>ResourceCapability: verifyInitialResourceAccess()
RouterReconnectionITCase->>CamelCapability: verifyInitialCamelToolInvocation()
RouterReconnectionITCase->>WanakuRouter: restartRouter()
WanakuRouter-->>HttpCapability: connectionLost()
WanakuRouter-->>ResourceCapability: connectionLost()
WanakuRouter-->>CamelCapability: connectionLost()
HttpCapability->>WanakuRouter: reconnect()
ResourceCapability->>WanakuRouter: reconnect()
CamelCapability->>WanakuRouter: reconnect()
RouterReconnectionITCase->>HttpCapability: verifyHttpToolInvocationAfterRestart()
RouterReconnectionITCase->>ResourceCapability: verifyResourceAccessAfterRestart()
RouterReconnectionITCase->>CamelCapability: verifyCamelToolInvocationAfterRestart()
RouterReconnectionITCase->>CrossCapabilityTestBase: tearDownEnvironment()
CrossCapabilityTestBase->>WanakuRouter: stopRouter()
RouterReconnectionITCase-->>JUnitRunner: reportSuccess()
Updated class diagram for cross-capability router reconnection testsclassDiagram
class CrossCapabilityTestBase {
<<abstract>>
- WanakuRouter router
- HttpCapabilityClient httpClient
- ResourceCapabilityClient resourceClient
- CamelCapabilityClient camelClient
+ setUpEnvironment()
+ tearDownEnvironment()
+ startRouter()
+ stopRouter()
+ createHttpClient()
+ createResourceClient()
+ createCamelClient()
}
class RouterReconnectionITCase {
+ RouterReconnectionITCase()
+ verifyHttpReconnection()
+ verifyResourceReconnection()
+ verifyCamelReconnection()
+ verifyMixedFlowAfterRestart()
}
class WanakuRouter {
+ start()
+ stop()
+ restart()
}
class HttpCapabilityClient {
+ connect()
+ invokeTool(toolName, payload)
}
class ResourceCapabilityClient {
+ connect()
+ listResources()
+ readResource(path)
}
class CamelCapabilityClient {
+ connect()
+ invokeRoute(routeId, payload)
}
CrossCapabilityTestBase <|-- RouterReconnectionITCase
CrossCapabilityTestBase --> WanakuRouter
CrossCapabilityTestBase --> HttpCapabilityClient
CrossCapabilityTestBase --> ResourceCapabilityClient
CrossCapabilityTestBase --> CamelCapabilityClient
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The README and test descriptions say the router is restarted on new ports, but
restartRouterWithSamePortsexplicitly enforces reuse of the same ports and throws if they change—consider aligning the documentation with the actual behavior or adjusting the implementation to truly support a port change scenario. CrossCapabilityTestBaseassumes a freshResourceProviderManager/CamelCapabilityManagerper test; if these methods are ever called multiple times within a single test, prior instances could be overwritten without being stopped—consider adding guards or explicit stop logic before reassigning the managers to make the lifecycle more robust.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The README and test descriptions say the router is restarted on new ports, but `restartRouterWithSamePorts` explicitly enforces reuse of the same ports and throws if they change—consider aligning the documentation with the actual behavior or adjusting the implementation to truly support a port change scenario.
- `CrossCapabilityTestBase` assumes a fresh `ResourceProviderManager`/`CamelCapabilityManager` per test; if these methods are ever called multiple times within a single test, prior instances could be overwritten without being stopped—consider adding guards or explicit stop logic before reassigning the managers to make the lifecycle more robust.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Closes: #66
Summary by Sourcery
Add a new cross-capability integration test module that verifies Wanaku capabilities reconnect after a router restart and update documentation to describe the new tests and test structure.
New Features:
Enhancements:
Tests: