Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6399#discussion_r204721547
  
    --- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/operators/DataSourceTaskTest.java
 ---
    @@ -45,33 +46,30 @@
     
     public class DataSourceTaskTest extends TaskTestBase {
     
    +   @Rule
    +   public TemporaryFolder tempFolder = new TemporaryFolder();
    +
        private static final int MEMORY_MANAGER_SIZE = 1024 * 1024;
     
        private static final int NETWORK_BUFFER_SIZE = 1024;
     
        private List<Record> outList;
    -   
    -   private String tempTestPath = 
DataSinkTaskTest.constructTestPath(DataSourceTaskTest.class, "dst_test");
    -   
    -   @After
    -   public void cleanUp() {
    -           File tempTestFile = new File(this.tempTestPath);
    -           if(tempTestFile.exists()) {
    -                   tempTestFile.delete();
    -           }
    -   }
    +
    +   private final String tempTestFileName = getClass().getName() + 
"-dst_test";
        
        @Test
        public void testDataSourceTask() {
                int keyCnt = 100;
                int valCnt = 20;
                
                this.outList = new ArrayList<Record>();
    -           
    +           File tempTestFile = null;
                try {
    -                   InputFilePreparator.prepareInputFile(new 
UniformRecordGenerator(keyCnt, valCnt, false), 
    -                           this.tempTestPath, true);
    +                   tempTestFile = tempFolder.newFile(tempTestFileName);
    +                   InputFilePreparator.prepareInputFile(new 
UniformRecordGenerator(keyCnt, valCnt, false),
    +                           tempTestFile, true);
                } catch (IOException e1) {
    +                   System.err.println(e1);
    --- End diff --
    
    let's change the method signature to throw `IOException` and remove the 
try/catch block.


---

Reply via email to