dcapwell commented on code in PR #4202:
URL: https://github.com/apache/cassandra/pull/4202#discussion_r2155100141


##########
test/unit/org/apache/cassandra/utils/AccordGenerators.java:
##########
@@ -757,6 +780,67 @@ public static Gen<Topology> topologyGen(Gen.LongGen 
epochGen, Gen<Ranges> ranges
         };
     }
 
+    public static Gen<FetchTopologies> fetchTopologiesGen()
+    {
+        Gen.LongGen epochGen = AccordGens.epochs();
+        Gen.LongGen maxEpochGen = rs -> {
+            if (rs.decide(0.3))
+                return Long.MAX_VALUE;
+            return epochGen.nextLong(rs);
+        };
+        return rs -> {
+            long a = epochGen.nextLong(rs);
+            long b = maxEpochGen.nextLong(rs);
+            while (a == b)
+                b = maxEpochGen.nextLong(rs);
+            if (a > b)
+            {
+                long tmp = a;
+                a = b;
+                b = tmp;
+            }
+            return new FetchTopologies(a, b);
+        };
+    }
+
+    public static Gen<TopologyManager.TopologyRange> topologyRangeGen()
+    {
+        Gen.LongGen epochGen = AccordGens.epochs();
+        return rs -> {
+            // settle on 1 partitioner
+            IPartitioner partitioner = partitioner().next(rs);
+            Supplier<Topology> topologyGen = () -> {
+                if (rs.decide(.3)) return Topology.EMPTY;

Review Comment:
   `topologyGen` doesn't support empty topologies, but that actually matters 
for `TopologyRange` so made sure to include



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to