JeetKunDoug commented on code in PR #58:
URL: https://github.com/apache/cassandra-sidecar/pull/58#discussion_r1312416071


##########
client/src/testFixtures/java/org/apache/cassandra/sidecar/client/SidecarClientTest.java:
##########
@@ -255,6 +256,31 @@ public void testTimeSkewFromReplicaSet() throws Exception
         validateResponseServed(ApiEndpointsV1.TIME_SKEW_ROUTE);
     }
 
+    @Test
+    public void testTokenRangeReplicasFromReplicaSet() throws Exception
+    {
+        String keyspace = "test";
+        String tokenRangeReplicasAsString = "{\"replicaState\":{" +
+                                            "\"127.0.0.1:7000\":\"NORMAL\"}," +
+                                            
"\"writeReplicas\":[{\"start\":\"-9223372036854775808\"," +
+                                            
"\"end\":\"9223372036854775807\",\"replicasByDatacenter\":" +
+                                            
"{\"datacenter1\":[\"127.0.0.1:7000\"]}}],\"readReplicas\":" +
+                                            
"[{\"start\":\"-9223372036854775808\",\"end\":\"9223372036854775807\"," +
+                                            
"\"replicasByDatacenter\":{\"datacenter1\":[\"127.0.0.1:7000\"]}}]}";
+        MockResponse response = new 
MockResponse().setResponseCode(OK.code()).setBody(tokenRangeReplicasAsString);
+        enqueue(response);
+
+        TokenRangeReplicasResponse result = 
client.tokenRangeReplicas(instances.subList(1, 2), keyspace)
+                                                  .get(30, TimeUnit.SECONDS);
+        assertThat(result).isNotNull();
+        assertThat(result.writeReplicas()).hasSize(1);

Review Comment:
   As we've discussed in other places - can we validate that the data the mock 
server responded with was actually what we got? It's good to make sure there 
aren't any JSON serialization issues by actually validating everything here 
rather than just the shape of the response.



-- 
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]

Reply via email to