org.apache.flink.testutils.junit.RetryOnFailure Java Examples

The following examples show how to use org.apache.flink.testutils.junit.RetryOnFailure. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerSampledSize() {
	verifySamplerFixedSampleSize(1, true);
	verifySamplerFixedSampleSize(10, true);
	verifySamplerFixedSampleSize(100, true);
	verifySamplerFixedSampleSize(1234, true);
	verifySamplerFixedSampleSize(9999, true);
	verifySamplerFixedSampleSize(20000, true);

	verifySamplerFixedSampleSize(1, false);
	verifySamplerFixedSampleSize(10, false);
	verifySamplerFixedSampleSize(100, false);
	verifySamplerFixedSampleSize(1234, false);
	verifySamplerFixedSampleSize(9999, false);
}
 
Example #2
Source File: YarnFileStageTestS3ITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testRecursiveUploadForYarnS3n() throws Exception {
	// skip test on Hadoop 3: https://issues.apache.org/jira/browse/HADOOP-14738
	Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0);

	try {
		Class.forName("org.apache.hadoop.fs.s3native.NativeS3FileSystem");
	} catch (ClassNotFoundException e) {
		// not in the classpath, cannot run this test
		String msg = "Skipping test because NativeS3FileSystem is not in the class path";
		log.info(msg);
		assumeNoException(msg, e);
	}
	testRecursiveUploadForYarn("s3n", "testYarn-s3n");
}
 
Example #3
Source File: RandomSamplerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerSampledSize() {
	verifySamplerFixedSampleSize(1, true);
	verifySamplerFixedSampleSize(10, true);
	verifySamplerFixedSampleSize(100, true);
	verifySamplerFixedSampleSize(1234, true);
	verifySamplerFixedSampleSize(9999, true);
	verifySamplerFixedSampleSize(20000, true);

	verifySamplerFixedSampleSize(1, false);
	verifySamplerFixedSampleSize(10, false);
	verifySamplerFixedSampleSize(100, false);
	verifySamplerFixedSampleSize(1234, false);
	verifySamplerFixedSampleSize(9999, false);
}
 
Example #4
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerSampledSize() {
	verifySamplerFixedSampleSize(1, true);
	verifySamplerFixedSampleSize(10, true);
	verifySamplerFixedSampleSize(100, true);
	verifySamplerFixedSampleSize(1234, true);
	verifySamplerFixedSampleSize(9999, true);
	verifySamplerFixedSampleSize(20000, true);

	verifySamplerFixedSampleSize(1, false);
	verifySamplerFixedSampleSize(10, false);
	verifySamplerFixedSampleSize(100, false);
	verifySamplerFixedSampleSize(1234, false);
	verifySamplerFixedSampleSize(9999, false);
}
 
Example #5
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testPoissonSamplerDistribution() {
	verifyPoissonSampler(0.01d);
	verifyPoissonSampler(0.05d);
	verifyPoissonSampler(0.1d);
	verifyPoissonSampler(0.5d);
}
 
Example #6
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerSampledSize2() {
	RandomSampler<Double> sampler = new ReservoirSamplerWithoutReplacement<Double>(20000);
	Iterator<Double> sampled = sampler.sample(source.iterator());
	assertTrue("ReservoirSamplerWithoutReplacement sampled output size should not beyond the source size.", getSize(sampled) == SOURCE_SIZE);
}
 
Example #7
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerDuplicateElements() {
	verifyRandomSamplerDuplicateElements(new ReservoirSamplerWithoutReplacement<Double>(100));
	verifyRandomSamplerDuplicateElements(new ReservoirSamplerWithoutReplacement<Double>(1000));
	verifyRandomSamplerDuplicateElements(new ReservoirSamplerWithoutReplacement<Double>(5000));
}
 
Example #8
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerWithReplacement() {
	verifyReservoirSamplerWithReplacement(100, false);
	verifyReservoirSamplerWithReplacement(500, false);
	verifyReservoirSamplerWithReplacement(1000, false);
	verifyReservoirSamplerWithReplacement(5000, false);
}
 
Example #9
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerWithMultiSourcePartitions1() {
	initSourcePartition();

	verifyReservoirSamplerWithoutReplacement(100, true);
	verifyReservoirSamplerWithoutReplacement(500, true);
	verifyReservoirSamplerWithoutReplacement(1000, true);
	verifyReservoirSamplerWithoutReplacement(5000, true);
}
 
Example #10
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerWithMultiSourcePartitions2() {
	initSourcePartition();

	verifyReservoirSamplerWithReplacement(100, true);
	verifyReservoirSamplerWithReplacement(500, true);
	verifyReservoirSamplerWithReplacement(1000, true);
	verifyReservoirSamplerWithReplacement(5000, true);
}
 
Example #11
Source File: RocksDBWriteBatchPerformanceTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 2000)
@RetryOnFailure(times = 3)
public void benchMark() throws Exception {

	int num = 10000;

	List<Tuple2<byte[], byte[]>> data = new ArrayList<>(num);
	for (int i = 0; i < num; ++i) {
		data.add(new Tuple2<>((KEY_PREFIX + i).getBytes(), VALUE.getBytes()));
	}

	log.info("--------------> put VS WriteBatch with disableWAL=false <--------------");

	long t1 = benchMarkHelper(data, false, WRITETYPE.PUT);
	long t2 = benchMarkHelper(data, false, WRITETYPE.WRITE_BATCH);

	log.info("Single Put with disableWAL is false for {} records costs {}" , num, t1);
	log.info("WriteBatch with disableWAL is false for {} records costs {}" , num, t2);

	log.info("--------------> put VS WriteBatch with disableWAL=true <--------------");

	t1 = benchMarkHelper(data, true, WRITETYPE.PUT);
	t2 = benchMarkHelper(data, true, WRITETYPE.WRITE_BATCH);

	log.info("Single Put with disableWAL is true for {} records costs {}" , num, t1);
	log.info("WriteBatch with disableWAL is true for {} records costs {}" , num, t2);
}
 
Example #12
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testBernoulliSamplerFraction() {
	verifySamplerFraction(0.01, false);
	verifySamplerFraction(0.05, false);
	verifySamplerFraction(0.1, false);
	verifySamplerFraction(0.3, false);
	verifySamplerFraction(0.5, false);
	verifySamplerFraction(0.854, false);
	verifySamplerFraction(0.99, false);
}
 
Example #13
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testBernoulliSamplerDuplicateElements() {
	verifyRandomSamplerDuplicateElements(new BernoulliSampler<Double>(0.01));
	verifyRandomSamplerDuplicateElements(new BernoulliSampler<Double>(0.1));
	verifyRandomSamplerDuplicateElements(new BernoulliSampler<Double>(0.5));
}
 
Example #14
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testPoissonSamplerFraction() {
	verifySamplerFraction(0.01, true);
	verifySamplerFraction(0.05, true);
	verifySamplerFraction(0.1, true);
	verifySamplerFraction(0.5, true);
	verifySamplerFraction(0.854, true);
	verifySamplerFraction(0.99, true);
	verifySamplerFraction(1.5, true);
}
 
Example #15
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testBernoulliSamplerDistribution() {
	verifyBernoulliSampler(0.01d);
	verifyBernoulliSampler(0.05d);
	verifyBernoulliSampler(0.1d);
	verifyBernoulliSampler(0.5d);
}
 
Example #16
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerWithoutReplacement() {
	verifyReservoirSamplerWithoutReplacement(100, false);
	verifyReservoirSamplerWithoutReplacement(500, false);
	verifyReservoirSamplerWithoutReplacement(1000, false);
	verifyReservoirSamplerWithoutReplacement(5000, false);
}
 
Example #17
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerSampledSize2() {
	RandomSampler<Double> sampler = new ReservoirSamplerWithoutReplacement<Double>(20000);
	Iterator<Double> sampled = sampler.sample(source.iterator());
	assertTrue("ReservoirSamplerWithoutReplacement sampled output size should not beyond the source size.", getSize(sampled) == SOURCE_SIZE);
}
 
Example #18
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerDuplicateElements() {
	verifyRandomSamplerDuplicateElements(new ReservoirSamplerWithoutReplacement<Double>(100));
	verifyRandomSamplerDuplicateElements(new ReservoirSamplerWithoutReplacement<Double>(1000));
	verifyRandomSamplerDuplicateElements(new ReservoirSamplerWithoutReplacement<Double>(5000));
}
 
Example #19
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerWithoutReplacement() {
	verifyReservoirSamplerWithoutReplacement(100, false);
	verifyReservoirSamplerWithoutReplacement(500, false);
	verifyReservoirSamplerWithoutReplacement(1000, false);
	verifyReservoirSamplerWithoutReplacement(5000, false);
}
 
Example #20
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerWithReplacement() {
	verifyReservoirSamplerWithReplacement(100, false);
	verifyReservoirSamplerWithReplacement(500, false);
	verifyReservoirSamplerWithReplacement(1000, false);
	verifyReservoirSamplerWithReplacement(5000, false);
}
 
Example #21
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerWithMultiSourcePartitions1() {
	initSourcePartition();

	verifyReservoirSamplerWithoutReplacement(100, true);
	verifyReservoirSamplerWithoutReplacement(500, true);
	verifyReservoirSamplerWithoutReplacement(1000, true);
	verifyReservoirSamplerWithoutReplacement(5000, true);
}
 
Example #22
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testReservoirSamplerWithMultiSourcePartitions2() {
	initSourcePartition();

	verifyReservoirSamplerWithReplacement(100, true);
	verifyReservoirSamplerWithReplacement(500, true);
	verifyReservoirSamplerWithReplacement(1000, true);
	verifyReservoirSamplerWithReplacement(5000, true);
}
 
Example #23
Source File: RocksDBWriteBatchPerformanceTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 2000)
@RetryOnFailure(times = 3)
public void benchMark() throws Exception {

	int num = 10000;

	List<Tuple2<byte[], byte[]>> data = new ArrayList<>(num);
	for (int i = 0; i < num; ++i) {
		data.add(new Tuple2<>((KEY_PREFIX + i).getBytes(), VALUE.getBytes()));
	}

	log.info("--------------> put VS WriteBatch with disableWAL=false <--------------");

	long t1 = benchMarkHelper(data, false, WRITETYPE.PUT);
	long t2 = benchMarkHelper(data, false, WRITETYPE.WRITE_BATCH);

	log.info("Single Put with disableWAL is false for {} records costs {}" , num, t1);
	log.info("WriteBatch with disableWAL is false for {} records costs {}" , num, t2);

	log.info("--------------> put VS WriteBatch with disableWAL=true <--------------");

	t1 = benchMarkHelper(data, true, WRITETYPE.PUT);
	t2 = benchMarkHelper(data, true, WRITETYPE.WRITE_BATCH);

	log.info("Single Put with disableWAL is true for {} records costs {}" , num, t1);
	log.info("WriteBatch with disableWAL is true for {} records costs {}" , num, t2);
}
 
Example #24
Source File: YarnFileStageTestS3ITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testRecursiveUploadForYarnS3a() throws Exception {
	try {
		Class.forName("org.apache.hadoop.fs.s3a.S3AFileSystem");
	} catch (ClassNotFoundException e) {
		// not in the classpath, cannot run this test
		String msg = "Skipping test because S3AFileSystem is not in the class path";
		log.info(msg);
		assumeNoException(msg, e);
	}
	testRecursiveUploadForYarn("s3a", "testYarn-s3a");
}
 
Example #25
Source File: RandomSamplerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testBernoulliSamplerDistribution() {
	verifyBernoulliSampler(0.01d);
	verifyBernoulliSampler(0.05d);
	verifyBernoulliSampler(0.1d);
	verifyBernoulliSampler(0.5d);
}
 
Example #26
Source File: RandomSamplerTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testBernoulliSamplerFraction() {
	verifySamplerFraction(0.01, false);
	verifySamplerFraction(0.05, false);
	verifySamplerFraction(0.1, false);
	verifySamplerFraction(0.3, false);
	verifySamplerFraction(0.5, false);
	verifySamplerFraction(0.854, false);
	verifySamplerFraction(0.99, false);
}
 
Example #27
Source File: RandomSamplerTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testBernoulliSamplerDuplicateElements() {
	verifyRandomSamplerDuplicateElements(new BernoulliSampler<Double>(0.01));
	verifyRandomSamplerDuplicateElements(new BernoulliSampler<Double>(0.1));
	verifyRandomSamplerDuplicateElements(new BernoulliSampler<Double>(0.5));
}
 
Example #28
Source File: RandomSamplerTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testPoissonSamplerFraction() {
	verifySamplerFraction(0.01, true);
	verifySamplerFraction(0.05, true);
	verifySamplerFraction(0.1, true);
	verifySamplerFraction(0.5, true);
	verifySamplerFraction(0.854, true);
	verifySamplerFraction(0.99, true);
	verifySamplerFraction(1.5, true);
}
 
Example #29
Source File: RandomSamplerTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testBernoulliSamplerDistribution() {
	verifyBernoulliSampler(0.01d);
	verifyBernoulliSampler(0.05d);
	verifyBernoulliSampler(0.1d);
	verifyBernoulliSampler(0.5d);
}
 
Example #30
Source File: RandomSamplerTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
@RetryOnFailure(times = 3)
public void testPoissonSamplerDistribution() {
	verifyPoissonSampler(0.01d);
	verifyPoissonSampler(0.05d);
	verifyPoissonSampler(0.1d);
	verifyPoissonSampler(0.5d);
}