FALCON-2338 EntityGraphTest.initConfigStore fails intermittently
The error occurs only when the MetadataMappingServiceTest testsuite runs before the testcase mentioned above. This test suite creates a file in target folder 'target/store/PROCESS/sample-process.xml' which isn't deleted post the test.
The change proposed in this pull request deletes the files and the tests in EntityGraphTest suite passed.
pallavi-rao could you please check this? thanks!
Author: sonia-garudi <sgarudi@us.ibm.com>
Reviewers: @pallavi-rao
Closes #411 from sonia-garudi/FALCON-2338 and squashes the following commits:
54b15f90a [sonia-garudi] Removed unused and duplicate import statements
b35b00dcc [sonia-garudi] Edit EntityGraphTest.java to delete the config store before and after suite
diff --git a/common/src/test/java/org/apache/falcon/entity/v0/EntityGraphTest.java b/common/src/test/java/org/apache/falcon/entity/v0/EntityGraphTest.java
index 20f2871..7cdd6c7 100644
--- a/common/src/test/java/org/apache/falcon/entity/v0/EntityGraphTest.java
+++ b/common/src/test/java/org/apache/falcon/entity/v0/EntityGraphTest.java
@@ -49,6 +49,14 @@
import java.util.List;
import java.util.Set;
+import org.apache.falcon.util.StartupProperties;
+import org.apache.hadoop.conf.Configuration;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+import java.io.IOException;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+
/**
* Entity graph tests.
*/
@@ -475,4 +483,16 @@
Assert.assertEquals(1, entities.size());
Assert.assertTrue(entities.contains(cluster));
}
+
+ @BeforeSuite
+ @AfterSuite
+ public void cleanup() throws IOException {
+ Path path = new Path(StartupProperties.get().
+ getProperty("config.store.uri"));
+ FileSystem fs = FileSystem.get(path.toUri(), new Configuration());
+ fs.delete(path, true);
+ System.out.println("Cleaned up " + path);
+ }
+
+
}