HDFS-12181. Ozone: Fix TestContainerReplicationManager by setting proper log level for LogCapturer. Contributed by Mukul Kumar Singh.

This commit is contained in:
Xiaoyu Yao 2017-07-21 14:19:26 -07:00 committed by Owen O'Malley
parent ca096501bf
commit eda559ffd2
2 changed files with 5 additions and 3 deletions

View File

@ -64,7 +64,7 @@
* computes the replication levels for each container.
*/
public class ContainerReplicationManager implements Closeable {
static final Logger LOG =
public static final Logger LOG =
LoggerFactory.getLogger(ContainerReplicationManager.class);
private final NodePoolManager poolManager;

View File

@ -35,7 +35,7 @@
import org.apache.hadoop.ozone.scm.node.NodePoolManager;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.test.GenericTestUtils.LogCapturer;
import org.apache.log4j.Level;
import org.slf4j.event.Level;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -74,10 +74,12 @@ public class TestContainerReplicationManager {
@After
public void tearDown() throws Exception {
logCapturer.stopCapturing();
GenericTestUtils.setLogLevel(ContainerReplicationManager.LOG, Level.INFO);
}
@Before
public void setUp() throws Exception {
GenericTestUtils.setLogLevel(ContainerReplicationManager.LOG, Level.DEBUG);
Map<DatanodeID, NodeManager.NODESTATE> nodeStateMap = new HashMap<>();
// We are setting up 3 pools with 24 nodes each in this cluster.
// First we create 72 Datanodes.
@ -234,7 +236,7 @@ public void testAddingNewPoolWorks()
throws TimeoutException, InterruptedException, IOException {
LogCapturer inProgressLog = LogCapturer.captureLogs(
LogFactory.getLog(InProgressPool.class));
GenericTestUtils.setLogLevel(InProgressPool.LOG, Level.ALL);
GenericTestUtils.setLogLevel(InProgressPool.LOG, Level.DEBUG);
try {
DatanodeID id = SCMTestUtils.getDatanodeID();
((ReplicationNodeManagerMock) (nodeManager)).addNode(id, NodeManager