You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by if...@apache.org on 2022/02/07 14:05:10 UTC

[cassandra-harry] 01/03: Make number of runs configurable

This is an automated email from the ASF dual-hosted git repository.

ifesdjeen pushed a commit to branch release
in repository https://gitbox.apache.org/repos/asf/cassandra-harry.git

commit 40dc69bba89bbe175a5a119747a1782fdbd7e9c2
Author: Alex Petrov <ol...@gmail.com>
AuthorDate: Mon Feb 7 14:33:09 2022 +0100

    Make number of runs configurable
---
 harry-core/src/harry/generators/PCGFastPure.java                  | 2 +-
 harry-core/test/harry/generators/DataGeneratorsTest.java          | 2 +-
 harry-core/test/harry/generators/RandomGeneratorTest.java         | 2 +-
 harry-core/test/harry/model/ApproximateClockTest.java             | 2 +-
 harry-core/test/harry/model/OpSelectorsTest.java                  | 2 +-
 harry-core/test/harry/operations/RelationTest.java                | 4 ++--
 harry-core/test/harry/util/RangesTest.java                        | 8 ++++----
 harry-integration/test/harry/ddl/SchemaGenTest.java               | 2 +-
 .../test/harry/generators/DataGeneratorsIntegrationTest.java      | 4 +++-
 harry-integration/test/harry/model/QuerySelectorNegativeTest.java | 4 ++--
 10 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/harry-core/src/harry/generators/PCGFastPure.java b/harry-core/src/harry/generators/PCGFastPure.java
index 9e438dc..caed276 100644
--- a/harry-core/src/harry/generators/PCGFastPure.java
+++ b/harry-core/src/harry/generators/PCGFastPure.java
@@ -25,7 +25,7 @@ package harry.generators;
  * https://github.com/imneme/pcg-c
  * https://github.com/imneme/pcg-cpp
  * <p>
- * Original library developed by Melissa O'Neill <on...@pcg-random.org>
+ * Original library developed by Melissa O'Neill (oneill@pcg-random.org)
  */
 public class PCGFastPure
 {
diff --git a/harry-core/test/harry/generators/DataGeneratorsTest.java b/harry-core/test/harry/generators/DataGeneratorsTest.java
index 386644f..8b35418 100644
--- a/harry-core/test/harry/generators/DataGeneratorsTest.java
+++ b/harry-core/test/harry/generators/DataGeneratorsTest.java
@@ -38,7 +38,7 @@ import static harry.generators.Bijections.Bijection;
 
 public class DataGeneratorsTest
 {
-    private static final int RUNS = 100;
+    private static final int RUNS = Integer.parseInt(System.getProperty("harry.test.cycles", "1000"));
     private static final RandomGenerator rand = RandomGenerator.forTests(1);
 
     @Test
diff --git a/harry-core/test/harry/generators/RandomGeneratorTest.java b/harry-core/test/harry/generators/RandomGeneratorTest.java
index d735670..15b8a77 100644
--- a/harry-core/test/harry/generators/RandomGeneratorTest.java
+++ b/harry-core/test/harry/generators/RandomGeneratorTest.java
@@ -32,7 +32,7 @@ import static junit.framework.TestCase.fail;
 
 public class RandomGeneratorTest
 {
-    private static int RUNS = 100000;
+    private static int RUNS = Integer.parseInt(System.getProperty("harry.test.cycles", "1000"));
 
     @Test
     public void testScale()
diff --git a/harry-core/test/harry/model/ApproximateClockTest.java b/harry-core/test/harry/model/ApproximateClockTest.java
index 4e86a66..ada6dbe 100644
--- a/harry-core/test/harry/model/ApproximateClockTest.java
+++ b/harry-core/test/harry/model/ApproximateClockTest.java
@@ -122,7 +122,7 @@ public class ApproximateClockTest
         signalError.await(10, TimeUnit.SECONDS);
         lock.unlock();
         executor.shutdown();
-        Assert.assertTrue(executor.awaitTermination(30, TimeUnit.SECONDS));
+        Assert.assertTrue(executor.awaitTermination(10, TimeUnit.SECONDS));
         scheduledExecutor.shutdown();
         Assert.assertTrue(scheduledExecutor.awaitTermination(10, TimeUnit.SECONDS));
         Throwable t = throwable.get();
diff --git a/harry-core/test/harry/model/OpSelectorsTest.java b/harry-core/test/harry/model/OpSelectorsTest.java
index e2ebd82..ac991f6 100644
--- a/harry-core/test/harry/model/OpSelectorsTest.java
+++ b/harry-core/test/harry/model/OpSelectorsTest.java
@@ -51,7 +51,7 @@ import harry.util.BitSet;
 
 public class OpSelectorsTest
 {
-    private static int RUNS = 10000;
+    private static int RUNS = Integer.parseInt(System.getProperty("harry.test.cycles", "1000"));
 
     @Test
     public void testRowDataDescriptorSupplier()
diff --git a/harry-core/test/harry/operations/RelationTest.java b/harry-core/test/harry/operations/RelationTest.java
index eaa7ddb..7436662 100644
--- a/harry-core/test/harry/operations/RelationTest.java
+++ b/harry-core/test/harry/operations/RelationTest.java
@@ -35,7 +35,7 @@ import harry.util.BitSet;
 
 public class RelationTest
 {
-    private static int RUNS = 100;
+    private static int RUNS = Integer.parseInt(System.getProperty("harry.test.cycles", "1000"));
 
     @Test
     public void testKeyGenerators()
@@ -67,7 +67,7 @@ public class RelationTest
                                                        Collections.emptyList(),
                                                        false);
 
-                long[] cds = new long[100];
+                long[] cds = new long[RUNS];
 
                 int[] fractions = new int[schemaSpec.clusteringKeys.size()];
                 int last = cds.length;
diff --git a/harry-core/test/harry/util/RangesTest.java b/harry-core/test/harry/util/RangesTest.java
index 1a0da7e..8bcad70 100644
--- a/harry-core/test/harry/util/RangesTest.java
+++ b/harry-core/test/harry/util/RangesTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
 
 public class RangesTest
 {
-
+    private static int RUNS = Integer.parseInt(System.getProperty("harry.test.cycles", "1000"));
     @Test
     public void simpleRangesTest()
     {
@@ -52,7 +52,7 @@ public class RangesTest
     @Test
     public void randomizedRangesTest()
     {
-        for (int i = 0; i < 1000; i++)
+        for (int i = 0; i < RUNS; i++)
             _randomizedRangesTest();
     }
 
@@ -60,7 +60,7 @@ public class RangesTest
     {
         List<Ranges.Range> rangesList = new ArrayList<>();
         Random rnd = new Random();
-        for (int i = 0; i < 100; i++)
+        for (int i = 0; i < RUNS; i++)
         {
             long a = rnd.nextInt(1000);
             long b = rnd.nextInt(1000);
@@ -73,7 +73,7 @@ public class RangesTest
         }
         Ranges ranges = new Ranges(rangesList);
 
-        for (int i = 0; i < 10000; i++)
+        for (int i = 0; i < RUNS; i++)
         {
             long descriptor = rnd.nextLong();
             long ts = rnd.nextInt(1000);
diff --git a/harry-integration/test/harry/ddl/SchemaGenTest.java b/harry-integration/test/harry/ddl/SchemaGenTest.java
index c6204cd..a55420e 100644
--- a/harry-integration/test/harry/ddl/SchemaGenTest.java
+++ b/harry-integration/test/harry/ddl/SchemaGenTest.java
@@ -46,7 +46,7 @@ import static org.quicktheories.generators.SourceDSL.integers;
 
 public class SchemaGenTest extends CQLTester
 {
-    private static final int CYCLES = 10;
+    private static final int CYCLES = Integer.parseInt(System.getProperty("harry.test.cycles", "1000"));
 
     // TODO: compact storage tests
     @Test
diff --git a/harry-integration/test/harry/generators/DataGeneratorsIntegrationTest.java b/harry-integration/test/harry/generators/DataGeneratorsIntegrationTest.java
index 0da7743..e337752 100644
--- a/harry-integration/test/harry/generators/DataGeneratorsIntegrationTest.java
+++ b/harry-integration/test/harry/generators/DataGeneratorsIntegrationTest.java
@@ -26,6 +26,8 @@ import relocated.shaded.com.google.common.collect.Iterators;
 
 public class DataGeneratorsIntegrationTest extends CQLTester
 {
+    private static final int CYCLES = Integer.parseInt(System.getProperty("harry.test.cycles", "1000"));
+
     @Test
     public void testTimestampTieResolution() throws Throwable
     {
@@ -40,7 +42,7 @@ public class DataGeneratorsIntegrationTest extends CQLTester
         {
             createTable(String.format("CREATE TABLE %%s (pk int PRIMARY KEY, v %s)",
                                       dataType.toString()));
-            for (int i = 0; i < 10_000; i++)
+            for (int i = 0; i < CYCLES; i++)
             {
                 long d1 = dataType.generator().adjustEntropyDomain(rng.nextLong());
                 long d2 = dataType.generator().adjustEntropyDomain(rng.nextLong());
diff --git a/harry-integration/test/harry/model/QuerySelectorNegativeTest.java b/harry-integration/test/harry/model/QuerySelectorNegativeTest.java
index 13ae548..8b9e69e 100644
--- a/harry-integration/test/harry/model/QuerySelectorNegativeTest.java
+++ b/harry-integration/test/harry/model/QuerySelectorNegativeTest.java
@@ -50,7 +50,7 @@ import static harry.corruptor.QueryResponseCorruptor.SimpleQueryResponseCorrupto
 @RunWith(Parameterized.class)
 public class QuerySelectorNegativeTest extends IntegrationTestBase
 {
-    private final int CYCLES = 1000;
+    private static final int RUNS = Integer.parseInt(System.getProperty("harry.test.cycles", "1000"));
 
     private final Random rnd = new Random();
 
@@ -116,7 +116,7 @@ public class QuerySelectorNegativeTest extends IntegrationTestBase
 
             QueryResponseCorruptor corruptor = this.corruptorFactory.create(run);
 
-            for (int i = 0; i < CYCLES; i++)
+            for (int i = 0; i < RUNS; i++)
                 visitor.visit();
 
             while (true)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org