maedhroz commented on code in PR #4222:
URL: https://github.com/apache/cassandra/pull/4222#discussion_r3011396388


##########
test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModelTest.java:
##########
@@ -753,6 +813,47 @@ public void deleteColumnUpdateDoesntHavePartitionState()
         model.validate(rows(row(metadata, 0, 1, null, List.of(1))), 
Select.builder(metadata).build());
     }
 
+    @Test
+    public void testRangeDeleteGeneratorWithClusteringValueGen()
+    {
+        TableMetadata metadata = new 
Builder().pk(1).ck(1).statics(0).regular(1).build();
+        ASTSingleTableModel model = new ASTSingleTableModel(metadata);
+
+        for (int i = 0; i < 10; i++)
+        {
+            model.update(Mutation.insert(metadata)
+                                 .value("pk", 0)
+                                 .value("ck", i)
+                                 .value("v", i)
+                                 .build());
+        }
+
+        Symbol ckSymbol = new Symbol("ck", Int32Type.instance);
+        Gen<Map<Symbol, Object>> clusteringGen = rnd -> {
+            LinkedHashMap<Symbol, Object> map = new LinkedHashMap<>();
+            map.put(ckSymbol, SourceDSL.integers().between(0, 
9).generate(rnd));
+            return map;
+        };
+
+        Gen<Mutation> mutationGen = new 
ASTGenerators.MutationGenBuilder(metadata)
+                                    .withClusterings(clusteringGen)
+                                    
.withDeletionKind(ASTGenerators.MutationGenBuilder.DeleteKind.Range)
+                                    .build();
+
+        RandomnessSource rnd = new JavaRandom(42L);
+        boolean rangeDeleteHit = false;
+        for (int i = 0; i < 1000; i++)
+        {
+            Mutation mutation = mutationGen.generate(rnd);
+            if (mutation instanceof Mutation.Delete)
+            {
+                rangeDeleteHit = true;
+                model.update(mutation);
+            }
+        }
+        assert rangeDeleteHit : "No range deletes were generated in 1000 
iterations";

Review Comment:
   ```suggestion
           assertTrue("No range deletes were generated in 1000 iterations", 
rangeDeleteHit);
   ```



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