Skip to content

Commit

Permalink
Try out fixing test log scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
errose28 committed Jul 18, 2022
1 parent 49f2f3b commit 84d2447
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
Expand Up @@ -20,7 +20,7 @@

import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.LogFactory;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.hdds.DFSConfigKeysLegacy;
import org.apache.hadoop.hdds.HddsConfigKeys;
Expand Down Expand Up @@ -171,7 +171,7 @@ public void testRemoveVolume() throws Exception {
// Attempting to remove a volume which does not exist in VolumeSet should
// log a warning.
LogCapturer logs = LogCapturer.captureLogs(
LogFactory.getLog(MutableVolumeSet.class));
LoggerFactory.getLogger(MutableVolumeSet.class));
volumeSet.removeVolume(HddsVolumeUtil.getHddsRoot(volume1));
assertEquals(1, volumeSet.getVolumesList().size());
String expectedLogMessage = "Volume : " +
Expand Down
Expand Up @@ -252,11 +252,6 @@ public static final class LogCapturer {
private WriterAppender appender;
private Logger logger;

public static LogCapturer captureLogs(Log l) {
Logger logger = ((Log4JLogger) l).getLogger();
return new LogCapturer(logger, getDefaultLayout());
}

public static LogCapturer captureLogs(org.slf4j.Logger logger) {
return new LogCapturer(toLog4j(logger), getDefaultLayout());
}
Expand Down
Expand Up @@ -21,7 +21,7 @@

import java.util.UUID;

import org.apache.commons.logging.LogFactory;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
import org.apache.hadoop.ozone.om.request.OMRequestTestUtils;
Expand Down Expand Up @@ -184,7 +184,7 @@ public void testValidateAndUpdateCacheWithQuota() throws Exception {
new OMBucketSetPropertyRequest(omRequest);

GenericTestUtils.LogCapturer logs = GenericTestUtils.LogCapturer
.captureLogs(LogFactory.getLog(OMBucketSetPropertyRequest.class));
.captureLogs(LoggerFactory.getLogger(OMBucketSetPropertyRequest.class));

OMClientResponse omClientResponse = omBucketSetPropertyRequest
.validateAndUpdateCache(ozoneManager, 1,
Expand Down
Expand Up @@ -20,7 +20,7 @@

import java.util.UUID;

import org.apache.commons.logging.LogFactory;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
import org.apache.hadoop.ozone.om.request.OMRequestTestUtils;
import org.apache.hadoop.ozone.om.response.OMClientResponse;
Expand Down Expand Up @@ -186,7 +186,7 @@ public void testValidateAndUpdateCacheWithQuota() throws Exception {
new OMVolumeSetQuotaRequest(originalRequest);

GenericTestUtils.LogCapturer logs = GenericTestUtils.LogCapturer
.captureLogs(LogFactory.getLog(OMVolumeSetQuotaRequest.class));
.captureLogs(LoggerFactory.getLogger(OMVolumeSetQuotaRequest.class));

OMClientResponse omClientResponse = omVolumeSetQuotaRequest
.validateAndUpdateCache(ozoneManager, 1,
Expand Down

0 comments on commit 84d2447

Please sign in to comment.