dcapwell commented on code in PR #4202: URL: https://github.com/apache/cassandra/pull/4202#discussion_r2155093318
########## test/unit/org/apache/cassandra/service/accord/serializers/TopologySerializersTest.java: ########## @@ -57,4 +72,98 @@ public void topology() Serializers.testSerde(output, TopologySerializers.topology, expected.forNode(node)); }); } + + /** + * This test focuses on correctness, given any random topology does the serde operation work as expected? + */ + @Test + public void compactTopology() + { + @SuppressWarnings({ "resource", "IOResourceOpenedButNotSafelyClosed" }) DataOutputBuffer output = new DataOutputBuffer(); + qt().forAll(AccordGenerators.partitioner().flatMap(p -> AccordGenerators.topologyGen(p))).check(expected -> { + AccordGenerators.maybeUpdatePartitioner(expected.ranges()); + + Serializers.testSerde(output, TopologySerializers.compactTopology, expected); + + for (Node.Id node : expected.nodes()) + Serializers.testSerde(output, TopologySerializers.compactTopology, expected.forNode(node)); + }); + } + + /** + * This test tries to create Topologies that would look closer to what one would expect in a production environment; namily each table having the same ranges. + */ + @Test + public void compactTopologyAreCompact() + { + Gen<Ranges> rangeGen = AccordGenerators.ranges(Gens.lists(Generators.toGen(CassandraGenerators.TABLE_ID_GEN)).ofSizeBetween(2, 10), + AccordGenerators.partitioner(), + Gens.ints().between(2, 1000)); + Gen<Topology> gen = AccordGenerators.topologyGen(AccordGens.epochs(), rangeGen); + @SuppressWarnings({ "resource", "IOResourceOpenedButNotSafelyClosed" }) DataOutputBuffer output = new DataOutputBuffer(); + CompactCollector collector = new CompactCollector(); Review Comment: this is what i used in the JIRA/Body to show the savings. Was helpful to compare changes. Its mostly dead code in CI though -- 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