Skip to content

Commit

Permalink
[hotfix] [tests] Remove usage of Assume in BoundedDataTests to avoid …
Browse files Browse the repository at this point in the history
…warnings during build/testing
  • Loading branch information
StephanEwen committed Jun 29, 2019
1 parent d88882c commit 4c93e68
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
10 changes: 10 additions & 0 deletions ...time/src/test/java/org/apache/flink/runtime/io/network/partition/BoundedDataTestBase.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public abstract class BoundedDataTestBase {
// BoundedData Instantiation
// ------------------------------------------------------------------------

protected abstract boolean isRegionBased();

protected abstract BoundedData createBoundedData(Path tempFilePath) throws IOException;

protected abstract BoundedData createBoundedDataWithRegion(Path tempFilePath, int regionSize) throws IOException;
Expand All @@ -78,6 +80,10 @@ public void testWriteAndReadData() throws Exception {

@Test
public void testWriteAndReadDataAcrossRegions() throws Exception {
if (!isRegionBased()) {
return;
}

try (BoundedData bd = createBoundedDataWithRegion(1_276_347)) {
testWriteAndReadData(bd);
}
Expand Down Expand Up @@ -125,6 +131,10 @@ public void testGetSizeSingleRegion() throws Exception {

@Test
public void testGetSizeMultipleRegions() throws Exception {
if (!isRegionBased()) {
return;
}

try (BoundedData bd = createBoundedDataWithRegion(100_000)) {
testGetSize(bd);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

package org.apache.flink.runtime.io.network.partition;

import org.junit.AssumptionViolatedException;

import java.io.IOException;
import java.nio.file.Path;

Expand All @@ -28,13 +26,18 @@
*/
public class FileChannelBoundedDataTest extends BoundedDataTestBase {

@Override
protected boolean isRegionBased() {
return false;
}

@Override
protected BoundedData createBoundedData(Path tempFilePath) throws IOException {
return FileChannelBoundedData.create(tempFilePath, BUFFER_SIZE);
}

@Override
protected BoundedData createBoundedDataWithRegion(Path tempFilePath, int regionSize) throws IOException {
throw new AssumptionViolatedException("FileChannelBoundedData is not region based");
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
*/
public class FileChannelMemoryMappedBoundedDataTest extends BoundedDataTestBase {

@Override
protected boolean isRegionBased() {
return true;
}

@Override
protected BoundedData createBoundedData(Path tempFilePath) throws IOException {
return FileChannelMemoryMappedBoundedData.create(tempFilePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
*/
public class MemoryMappedBoundedDataTest extends BoundedDataTestBase {

@Override
protected boolean isRegionBased() {
return true;
}

@Override
protected BoundedData createBoundedData(Path tempFilePath) throws IOException {
return MemoryMappedBoundedData.create(tempFilePath);
Expand Down

0 comments on commit 4c93e68

Please sign in to comment.