HADOOP-14494. ITestJets3tNativeS3FileSystemContract tests NPEs in teardown if store undefined. Contributed by Steve Loughran

This commit is contained in:
Mingliang Liu 2017-06-15 11:16:16 -07:00
parent 3f5108723c
commit f214a9961f

View File

@ -44,20 +44,22 @@ public abstract class NativeS3FileSystemContractBaseTest
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
store = getNativeFileSystemStore();
fs = new NativeS3FileSystem(store);
String fsname = conf.get(KEY_TEST_FS); String fsname = conf.get(KEY_TEST_FS);
if (StringUtils.isEmpty(fsname)) { if (StringUtils.isEmpty(fsname)) {
throw new AssumptionViolatedException( throw new AssumptionViolatedException(
"No test FS defined in :" + KEY_TEST_FS); "No test FS defined in :" + KEY_TEST_FS);
} }
store = getNativeFileSystemStore();
fs = new NativeS3FileSystem(store);
fs.initialize(URI.create(fsname), conf); fs.initialize(URI.create(fsname), conf);
} }
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
if (store != null) {
store.purge("test"); store.purge("test");
} }
}
@Test @Test
public void testCanonicalName() throws Exception { public void testCanonicalName() throws Exception {