Skip to content

Commit

Permalink
HBASE-26666. Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnar committed Feb 28, 2022
1 parent 17091e8 commit cef6e3b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashSet;
import java.util.Set;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.net.Address;
Expand All @@ -39,7 +40,6 @@
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hbase.thirdparty.com.google.common.io.Closeables;

@Category({ ClientTests.class, SmallTests.class })
Expand Down Expand Up @@ -73,8 +73,18 @@ public void testPrivateMethodExecutedInEventLoop() throws IllegalAccessException
assertThrows(AssertionError.class, () -> {
assert false;
});

final Set<String> methodsToCheck = new HashSet<>();
methodsToCheck.add("shutdown0");
methodsToCheck.add("sendRequest0");
methodsToCheck.add("connect");

for (Method method : NettyRpcConnection.class.getDeclaredMethods()) {
if (Modifier.isPrivate(method.getModifiers()) && !method.getName().contains("$")) {
if (!methodsToCheck.contains(method.getName())) {
LOG.info("skipping {}", method);
continue;
}
LOG.info("checking {}", method);
method.setAccessible(true);
// all private methods should be called inside the event loop thread, so calling it from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public void cleanUp() {
System.clearProperty("com.sun.security.enableCRLDP");
Security.setProperty("ocsp.enable", Boolean.FALSE.toString());
Security.setProperty("com.sun.security.enableCRLDP", Boolean.FALSE.toString());
x509Util.close();
}

@Test
Expand Down

0 comments on commit cef6e3b

Please sign in to comment.