HDFS-12156. TestFSImage fails without -Pnative

This commit is contained in:
Akira Ajisaka 2018-03-13 11:26:48 +09:00
parent 4afd50b106
commit 319defafc1
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
1 changed files with 9 additions and 0 deletions

View File

@ -48,6 +48,7 @@ import org.apache.hadoop.hdfs.protocol.BlockType;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption;
import org.apache.hadoop.io.erasurecode.ECSchema; import org.apache.hadoop.io.erasurecode.ECSchema;
import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.util.NativeCodeLoader;
import org.junit.Assert; import org.junit.Assert;
import org.apache.hadoop.fs.permission.PermissionStatus; import org.apache.hadoop.fs.permission.PermissionStatus;
@ -74,6 +75,7 @@ import org.apache.hadoop.hdfs.util.MD5FileUtils;
import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.test.PathUtils; import org.apache.hadoop.test.PathUtils;
import org.apache.hadoop.util.Time; import org.apache.hadoop.util.Time;
import org.junit.Assume;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
@ -99,6 +101,13 @@ public class TestFSImage {
setCompressCodec(conf, "org.apache.hadoop.io.compress.DefaultCodec"); setCompressCodec(conf, "org.apache.hadoop.io.compress.DefaultCodec");
setCompressCodec(conf, "org.apache.hadoop.io.compress.GzipCodec"); setCompressCodec(conf, "org.apache.hadoop.io.compress.GzipCodec");
setCompressCodec(conf, "org.apache.hadoop.io.compress.BZip2Codec"); setCompressCodec(conf, "org.apache.hadoop.io.compress.BZip2Codec");
}
@Test
public void testNativeCompression() throws IOException {
Assume.assumeTrue(NativeCodeLoader.isNativeCodeLoaded());
Configuration conf = new Configuration();
conf.setBoolean(DFSConfigKeys.DFS_IMAGE_COMPRESS_KEY, true);
setCompressCodec(conf, "org.apache.hadoop.io.compress.Lz4Codec"); setCompressCodec(conf, "org.apache.hadoop.io.compress.Lz4Codec");
} }