HADOOP-12240. Fix tests requiring native library to be skipped in non-native profile. Contributed by Masatake Iwasaki.
This commit is contained in:
parent
f02dd146f5
commit
90bda9c611
@ -964,6 +964,9 @@ Release 2.8.0 - UNRELEASED
|
||||
HADOOP-10615. FileInputStream in JenkinsHash#main() is never closed.
|
||||
(Chen He via ozawa)
|
||||
|
||||
HADOOP-12240. Fix tests requiring native library to be skipped in non-native
|
||||
profile. (Masatake Iwasaki via ozawa)
|
||||
|
||||
Release 2.7.2 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -19,19 +19,18 @@
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||
import org.apache.hadoop.util.NativeCodeLoader;
|
||||
import org.apache.hadoop.test.GenericTestUtils;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class TestCryptoStreamsWithOpensslAesCtrCryptoCodec
|
||||
extends TestCryptoStreams {
|
||||
|
||||
@BeforeClass
|
||||
public static void init() throws Exception {
|
||||
assumeTrue(NativeCodeLoader.isNativeCodeLoaded());
|
||||
GenericTestUtils.assumeNativeCodeLoaded();
|
||||
Configuration conf = new Configuration();
|
||||
conf.set(
|
||||
CommonConfigurationKeysPublic.HADOOP_SECURITY_CRYPTO_CODEC_CLASSES_AES_CTR_NOPADDING_KEY,
|
||||
|
@ -34,6 +34,7 @@
|
||||
import org.apache.hadoop.io.compress.DefaultCodec;
|
||||
import org.apache.hadoop.io.compress.GzipCodec;
|
||||
import org.apache.hadoop.io.serializer.JavaSerializationComparator;
|
||||
import org.apache.hadoop.test.GenericTestUtils;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@ -140,6 +141,7 @@ public void testAppend() throws Exception {
|
||||
|
||||
@Test(timeout = 30000)
|
||||
public void testAppendRecordCompression() throws Exception {
|
||||
GenericTestUtils.assumeNativeCodeLoaded();
|
||||
|
||||
Path file = new Path(ROOT_PATH, "testseqappendblockcompr.seq");
|
||||
fs.delete(file, true);
|
||||
@ -173,6 +175,7 @@ public void testAppendRecordCompression() throws Exception {
|
||||
|
||||
@Test(timeout = 30000)
|
||||
public void testAppendBlockCompression() throws Exception {
|
||||
GenericTestUtils.assumeNativeCodeLoaded();
|
||||
|
||||
Path file = new Path(ROOT_PATH, "testseqappendblockcompr.seq");
|
||||
fs.delete(file, true);
|
||||
@ -247,6 +250,8 @@ public void testAppendBlockCompression() throws Exception {
|
||||
|
||||
@Test(timeout = 30000)
|
||||
public void testAppendSort() throws Exception {
|
||||
GenericTestUtils.assumeNativeCodeLoaded();
|
||||
|
||||
Path file = new Path(ROOT_PATH, "testseqappendSort.seq");
|
||||
fs.delete(file, true);
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.impl.Log4JLogger;
|
||||
import org.apache.hadoop.fs.FileUtil;
|
||||
import org.apache.hadoop.util.NativeCodeLoader;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.hadoop.util.Time;
|
||||
import org.apache.log4j.Layout;
|
||||
@ -43,6 +44,7 @@
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.WriterAppender;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
@ -410,4 +412,11 @@ public static void assertNoThreadsMatching(String regex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Skip test if native code is not loaded.
|
||||
*/
|
||||
public static void assumeNativeCodeLoaded() {
|
||||
Assume.assumeTrue(NativeCodeLoader.isNativeCodeLoaded());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user