Skip to content
Permalink
Browse files
Changed problematic test to a cluster test to avoid random errors.
  • Loading branch information
leerho committed Dec 24, 2021
1 parent 039bd0b commit 78058684ecbbcbe84998c0784ccb48b8920ccf8e
Showing 1 changed file with 22 additions and 0 deletions.
@@ -29,6 +29,9 @@
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;

import java.io.PrintWriter;
import java.io.StringWriter;

import org.testng.annotations.Test;

import org.apache.datasketches.memory.Memory;
@@ -403,6 +406,25 @@ public void checkForceIncrement() {
}

@Test
public void cluster_checkEstimateSubsetSum() {
int cluster = 3;
int failCount = 0;
for (int i = 0; i < cluster; i++) {
try {
checkEstimateSubsetSum(); //Test to run cluster on
//System.out.println("Fail Count: " + failCount); //useful for debugging thresholds
break;
} catch (AssertionError ae) {
if (++failCount >= cluster) {
StringWriter sw = new StringWriter();
ae.printStackTrace(new PrintWriter(sw));
String str = sw.toString();
fail("Failed a cluster of " + cluster + "\n" + str);
}
}
}
}

public void checkEstimateSubsetSum() {
final int k = 10;
final ReservoirLongsSketch sketch = ReservoirLongsSketch.newInstance(k);

0 comments on commit 7805868

Please sign in to comment.