Skip to content
Permalink
Browse files

Skip the random sleep when doing non-parallel test runs.

  • Loading branch information
archiecobbs committed Jan 16, 2020
1 parent 17a6f39 commit 658e15b1a503d22b2bf1a8f2e99e0e03b9e58e17
Showing with 3 additions and 1 deletion.
  1. +3 −1 permazen-kv-test/src/main/java/io/permazen/kv/test/KVDatabaseTest.java
@@ -805,6 +805,7 @@ public void testApplyMutations(KVDatabase store) throws Exception {
private final int id;
private final KVDatabase store;
private final Random random;
private final boolean randomSleeps;
private final TreeMap<byte[], byte[]> committedData; // tracks actual committed data, if known
private final NavigableMap<String, String> committedDataView;
private final ArrayList<String> log = new ArrayList<>(KVDatabaseTest.this.getRandomTaskMaxIterations());
@@ -822,6 +823,7 @@ public RandomTask(int id, KVDatabase store, TreeMap<byte[], byte[]> committedDat
this.committedData = committedData;
this.committedDataView = stringView(this.committedData);
this.random = new Random(seed);
this.randomSleeps = committedData == null; // only add random sleeps in parallel mode
this.log("seed = " + seed);
}

@@ -1049,7 +1051,7 @@ assert s(knownValues.get(pair.getKey())).equals(s(pair.getValue())) :
knownValues.put(key, encodedCounter);
knownEmpty.remove(new KeyRange(key));
knownValuesChanged = true;
} else { // sleep
} else if (this.randomSleeps) { // sleep
final int millis = this.r(50);
this.log("sleep " + millis + "ms");
try {

0 comments on commit 658e15b

Please sign in to comment.
You can’t perform that action at this time.