HADOOP-11673. Skip using JUnit Assume in TestCodec.

Contributed by Brahma Reddy Battula.
This commit is contained in:
Chris Douglas 2015-03-08 19:15:46 -07:00
parent 6ee0d32b98
commit 790aa6790e
2 changed files with 7 additions and 12 deletions

View File

@ -184,6 +184,9 @@ Trunk (Unreleased)
HADOOP-11593. Convert site documentation from apt to markdown (stragglers) HADOOP-11593. Convert site documentation from apt to markdown (stragglers)
(Masatake Iwasaki via aw) (Masatake Iwasaki via aw)
HADOOP-11673. Skip using JUnit Assume in TestCodec. (Brahma Reddy Battula
via cdouglas)
BUG FIXES BUG FIXES
HADOOP-11473. test-patch says "-1 overall" even when all checks are +1 HADOOP-11473. test-patch says "-1 overall" even when all checks are +1

View File

@ -74,6 +74,7 @@ import org.junit.Assert;
import org.junit.Assume; import org.junit.Assume;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.junit.Assume.*;
public class TestCodec { public class TestCodec {
@ -364,10 +365,7 @@ public class TestCodec {
public void testCodecPoolGzipReuse() throws Exception { public void testCodecPoolGzipReuse() throws Exception {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, true); conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, true);
if (!ZlibFactory.isNativeZlibLoaded(conf)) { assumeTrue(ZlibFactory.isNativeZlibLoaded(conf));
LOG.warn("testCodecPoolGzipReuse skipped: native libs not loaded");
return;
}
GzipCodec gzc = ReflectionUtils.newInstance(GzipCodec.class, conf); GzipCodec gzc = ReflectionUtils.newInstance(GzipCodec.class, conf);
DefaultCodec dfc = ReflectionUtils.newInstance(DefaultCodec.class, conf); DefaultCodec dfc = ReflectionUtils.newInstance(DefaultCodec.class, conf);
Compressor c1 = CodecPool.getCompressor(gzc); Compressor c1 = CodecPool.getCompressor(gzc);
@ -723,10 +721,7 @@ public class TestCodec {
public void testNativeGzipConcat() throws IOException { public void testNativeGzipConcat() throws IOException {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, true); conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, true);
if (!ZlibFactory.isNativeZlibLoaded(conf)) { assumeTrue(ZlibFactory.isNativeZlibLoaded(conf));
LOG.warn("skipped: native libs not loaded");
return;
}
GzipConcatTest(conf, GzipCodec.GzipZlibDecompressor.class); GzipConcatTest(conf, GzipCodec.GzipZlibDecompressor.class);
} }
@ -840,10 +835,7 @@ public class TestCodec {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, useNative); conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, useNative);
if (useNative) { if (useNative) {
if (!ZlibFactory.isNativeZlibLoaded(conf)) { assumeTrue(ZlibFactory.isNativeZlibLoaded(conf));
LOG.warn("testGzipCodecWrite skipped: native libs not loaded");
return;
}
} else { } else {
assertFalse("ZlibFactory is using native libs against request", assertFalse("ZlibFactory is using native libs against request",
ZlibFactory.isNativeZlibLoaded(conf)); ZlibFactory.isNativeZlibLoaded(conf));