HBASE-23956 Use less resources running tests (#1266)

Addendum: TestNamespaceCommands was using up the limit on
nioeventloopgroup.... so create them per run of client.
This commit is contained in:
stack 2020-03-11 22:45:14 -07:00
parent 6a30b4eab4
commit 933cf33034
1 changed files with 12 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/**
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -20,7 +20,6 @@ package org.apache.hadoop.hbase.security.access;
import static org.apache.hadoop.hbase.AuthUtil.toGroupEntry;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.google.protobuf.BlockingRpcChannel;
import java.util.Arrays;
import java.util.List;
@ -42,6 +41,7 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContextImpl;
import org.apache.hadoop.hbase.ipc.NettyRpcClientConfigHelper;
import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService;
import org.apache.hadoop.hbase.security.User;
import org.apache.hadoop.hbase.security.access.Permission.Action;
@ -56,7 +56,6 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap;
@Category({SecurityTests.class, MediumTests.class})
@ -164,9 +163,13 @@ public class TestNamespaceCommands extends SecureTestUtil {
UTIL.getMiniHBaseCluster().getLiveRegionServerThreads()) {
ACCESS_CONTROLLER = rst.getRegionServer().getRegionServerCoprocessorHost().
findCoprocessor(AccessController.class);
if (ACCESS_CONTROLLER != null) break;
if (ACCESS_CONTROLLER != null) {
break;
}
}
if (ACCESS_CONTROLLER == null) {
throw new NullPointerException();
}
if (ACCESS_CONTROLLER == null) throw new NullPointerException();
UTIL.getAdmin().createNamespace(NamespaceDescriptor.create(TEST_NAMESPACE).build());
UTIL.getAdmin().createNamespace(NamespaceDescriptor.create(TEST_NAMESPACE2).build());
@ -354,9 +357,12 @@ public class TestNamespaceCommands extends SecureTestUtil {
assertEquals(0, ((List)USER_GROUP_WRITE.runAs(listAction)).size());
}
@Test
@SuppressWarnings("checkstyle:MethodLength") @Test
public void testGrantRevoke() throws Exception {
final String testUser = "testUser";
// Set this else in test context, with limit on the number of threads for
// netty eventloopgroup, we can run out of threads if one group used throughout.
NettyRpcClientConfigHelper.createEventLoopPerClient(conf);
// Test if client API actions are authorized
AccessTestAction grantAction = new AccessTestAction() {
@Override