frankgh commented on code in PR #209:
URL: https://github.com/apache/cassandra-sidecar/pull/209#discussion_r1999094494
##########
integration-framework/src/main/java/org/apache/cassandra/sidecar/testing/SharedClusterIntegrationTestBase.java:
##########
@@ -562,6 +534,25 @@ public static Cluster createDriverCluster(ICluster<?
extends IInstance> dtest)
return builder.build();
}
+ /**
+ * Wraps the Sidecar server and keeps a reference to the injector to be
able to dynamically retrieve
+ * objects for testing purposes
+ */
+ public static class ServerWrapper
+ {
+ public final Injector injector;
+ public final Server server;
+ public volatile int serverPort;
Review Comment:
The problem is that once the sidecar server is down, the port information is
no longer available. For the `SidecarPeerDownDetectorIntegrationTest` this
means that the information is lost when attempting to perform a health check on
a down node. The test will do the following:
- bring up a 3 node cassandra cluster, each managed by a sidecar instance
- perform health checks
- stop sidecar on one of the instances
- ensure health check fails
- start sidecar on the instance above
- ensure health check succeeds
Now if you stop Sidecar, and use the `actualPort` information from the
server, this information is not available, and your health check will fail, not
because the peer health monitor will correctly detect the node as down, but
instead with an `IllegalStateException` encountered when [retrieving the
actualPort](https://github.com/apache/cassandra-sidecar/blob/trunk/server/src/main/java/org/apache/cassandra/sidecar/server/Server.java#L250).
For that reason I decided to keep track of the port as a field, instead of
dynamically asking the instance for the port.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]