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

The following examples show how to use org.apache.flink.testutils.junit.RetryOnFailure. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 Project: flink   Source File: RandomSamplerTest.java    License: 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 3
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 Project: flink   Source File: YarnFileStageTestS3ITCase.java    License: 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 5
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 6
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 7
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 8
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 9
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 10
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 11
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 12
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 13
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 14
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 15
Source Project: Flink-CEPplus   Source File: RandomSamplerTest.java    License: 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 16
@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 17
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 18
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 19
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 20
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 21
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 22
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 23
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 24
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 25
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 26
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 27
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 28
Source Project: flink   Source File: RocksDBWriteBatchPerformanceTest.java    License: 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 29
Source Project: flink   Source File: RandomSamplerTest.java    License: 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 30
Source Project: flink   Source File: RandomSamplerTest.java    License: 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));
}