HDDS-142. TestMetadataStore fails on Windows.

Contributed by  Íñigo Goiri.
This commit is contained in:
Anu Engineer 2018-06-01 14:21:35 -07:00
parent 19560bb704
commit 1be05a3623

View File

@ -17,6 +17,8 @@
*/ */
package org.apache.hadoop.ozone; package org.apache.hadoop.ozone;
import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
@ -81,6 +83,11 @@ public static Collection<Object[]> data() {
@Before @Before
public void init() throws IOException { public void init() throws IOException {
if (OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_ROCKSDB.equals(storeImpl)) {
// The initialization of RocksDB fails on Windows
assumeNotWindows();
}
testDir = GenericTestUtils.getTestDir(getClass().getSimpleName() testDir = GenericTestUtils.getTestDir(getClass().getSimpleName()
+ "-" + storeImpl.toLowerCase()); + "-" + storeImpl.toLowerCase());
@ -104,10 +111,14 @@ public void init() throws IOException {
@After @After
public void cleanup() throws IOException { public void cleanup() throws IOException {
if (store != null) {
store.close(); store.close();
store.destroy(); store.destroy();
}
if (testDir != null) {
FileUtils.deleteDirectory(testDir); FileUtils.deleteDirectory(testDir);
} }
}
private byte[] getBytes(String str) { private byte[] getBytes(String str) {
return str == null ? null : return str == null ? null :