提交 9dc3b5f5 编写于 作者: V vongosling

Bugfix for the unstable test

上级 1970813c
...@@ -17,18 +17,16 @@ ...@@ -17,18 +17,16 @@
package org.apache.rocketmq.client.log; package org.apache.rocketmq.client.log;
import java.io.File;
import java.io.IOException;
import org.apache.rocketmq.common.MixAll; import org.apache.rocketmq.common.MixAll;
import org.apache.rocketmq.common.UtilAll; import org.apache.rocketmq.common.UtilAll;
import org.apache.rocketmq.logging.InternalLogger; import org.apache.rocketmq.logging.InternalLogger;
import org.apache.rocketmq.logging.InternalLoggerFactory; import org.apache.rocketmq.logging.InternalLoggerFactory;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.io.File;
import java.io.IOException;
public class ClientLoggerTest { public class ClientLoggerTest {
public static final String CLIENT_LOG_ROOT = "rocketmq.client.logRoot"; public static final String CLIENT_LOG_ROOT = "rocketmq.client.logRoot";
...@@ -46,13 +44,10 @@ public class ClientLoggerTest { ...@@ -46,13 +44,10 @@ public class ClientLoggerTest {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
logger.info("testClientlog test {}", i); logger.info("testClientlog test {}", i);
rocketmqCommon.info("common message {}", i, new RuntimeException()); rocketmqCommon.info("common message {}", i);
rocketmqRemoting.info("remoting message {}", i, new RuntimeException()); rocketmqRemoting.info("remoting message {}", i);
}
try {
Thread.sleep(10);
} catch (InterruptedException ignore) {
} }
String content = MixAll.file2String(LOG_DIR + "/rocketmq_client.log"); String content = MixAll.file2String(LOG_DIR + "/rocketmq_client.log");
Assert.assertTrue(content.contains("testClientlog")); Assert.assertTrue(content.contains("testClientlog"));
Assert.assertTrue(content.contains("RocketmqClient")); Assert.assertTrue(content.contains("RocketmqClient"));
...@@ -61,7 +56,7 @@ public class ClientLoggerTest { ...@@ -61,7 +56,7 @@ public class ClientLoggerTest {
Assert.assertTrue(content.contains("RocketmqRemoting")); Assert.assertTrue(content.contains("RocketmqRemoting"));
} }
@After @Before
public void cleanFiles() { public void cleanFiles() {
UtilAll.deleteFile(new File(LOG_DIR)); UtilAll.deleteFile(new File(LOG_DIR));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册