[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16145205#comment-16145205 ] ASF subversion and git services commented on ROCKETMQ-264: -- Commit 76464ba657eca3ceb1755777ea4601fa630593f3 in incubator-rocketmq's branch refs/heads/master from [~lindzh] [ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=76464ba ] ROCKETMQ-264 Fix ut's time-consuming problems closes apache/incubator-rocketmq#145 > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16143580#comment-16143580 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user vongosling commented on the issue: https://github.com/apache/incubator-rocketmq/pull/145 @lindzh Thanks, I made some modifications and merged this PR. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16143344#comment-16143344 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user coveralls commented on the issue: https://github.com/apache/incubator-rocketmq/pull/145 [![Coverage Status](https://coveralls.io/builds/13011028/badge)](https://coveralls.io/builds/13011028) Coverage decreased (-0.4%) to 38.703% when pulling **25e3791e5e5f937b8b2f1617ffb57a65f77ec23b on lindzh:fix_test_exeception** into **332df78e2bb6caadfc6f471445ebb1f9d224 on apache:develop**. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16143331#comment-16143331 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user lindzh commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r135436908 --- Diff: broker/src/test/java/org/apache/rocketmq/broker/filter/MessageStoreWithFilterTest.java --- @@ -76,6 +86,24 @@ } } +@Before +public void init() { +filterManager = ConsumerFilterManagerTest.gen(topicCount, msgPerTopic); +try { +master = gen(filterManager); +} catch (Exception e) { +e.printStackTrace(); --- End diff -- This is a DefaultMessageStore start progress that used in annotation Before.And can't add expect Exception in before,I think there is no need to add exception expect in before and all we want is while the messageStore is started or not. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16143328#comment-16143328 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user lindzh commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r135436434 --- Diff: store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java --- @@ -43,15 +43,24 @@ private SocketAddress BornHost; private SocketAddress StoreHost; private byte[] MessageBody; +private MessageStore messageStore; @Before public void init() throws Exception { StoreHost = new InetSocketAddress(InetAddress.getLocalHost(), 8123); BornHost = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 0); + +messageStore = buildMessageStore(); +boolean load = messageStore.load(); +assertTrue(load); +messageStore.start(); } @After public void destory() { +messageStore.shutdown(); +messageStore.destroy(); --- End diff -- Delete created files has been did before at this file after destroy. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16143307#comment-16143307 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user lindzh commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r135431420 --- Diff: store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java --- @@ -97,54 +110,46 @@ public MessageExtBrokerInner buildMessage() { @Test public void testGroupCommit() throws Exception { -long totalMsgs = 100; +long totalMsgs = 10; QUEUE_TOTAL = 1; MessageBody = StoreMessage.getBytes(); -MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); -messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8); -messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH); -MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig()); -boolean load = master.load(); -assertTrue(load); +for (long i = 0; i < totalMsgs; i++) { +messageStore.putMessage(buildMessage()); +} -master.start(); -verifyThatMasterIsFunctional(totalMsgs, master); +for (long i = 0; i < totalMsgs; i++) { +GetMessageResult result = messageStore.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); +assertThat(result).isNotNull(); +result.release(); +} +verifyThatMasterIsFunctional(totalMsgs, messageStore); } private void verifyThatMasterIsFunctional(long totalMsgs, MessageStore master) { -try { -for (long i = 0; i < totalMsgs; i++) { -master.putMessage(buildMessage()); -} - -for (long i = 0; i < totalMsgs; i++) { -GetMessageResult result = master.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); -assertThat(result).isNotNull(); -result.release(); - -} -} finally { -master.shutdown(); -master.destroy(); +for (long i = 0; i < totalMsgs; i++) { +master.putMessage(buildMessage()); +} + +for (long i = 0; i < totalMsgs; i++) { +GetMessageResult result = master.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); +assertThat(result).isNotNull(); +result.release(); + } } @Test public void testPullSize() throws Exception { -MessageStore messageStore = buildMessageStore(); -boolean load = messageStore.load(); -assertTrue(load); -messageStore.start(); String topic = "pullSizeTopic"; for (int i = 0; i < 32; i++) { MessageExtBrokerInner messageExtBrokerInner = buildMessage(); messageExtBrokerInner.setTopic(topic); messageExtBrokerInner.setQueueId(0); -PutMessageResult putMessageResult = messageStore.putMessage(messageExtBrokerInner); +messageStore.putMessage(messageExtBrokerInner); } //wait for consume queue build -Thread.sleep(100); +Thread.sleep(10); --- End diff -- In test scenario, 10ms is enough. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139842#comment-16139842 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user lindzh commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r134974332 --- Diff: broker/src/test/java/org/apache/rocketmq/broker/filter/MessageStoreWithFilterTest.java --- @@ -201,177 +229,143 @@ public void dispatch(DispatchRequest request) { @Test public void testGetMessage_withFilterBitMapAndConsumerChanged() { -int topicCount = 10, msgPerTopic = 10; -ConsumerFilterManager filterManager = ConsumerFilterManagerTest.gen(topicCount, msgPerTopic); - -DefaultMessageStore master = null; +List msgs = null; try { -master = gen(filterManager); +msgs = putMsg(master, topicCount, msgPerTopic); } catch (Exception e) { e.printStackTrace(); assertThat(true).isFalse(); } +// sleep to wait for consume queue has been constructed. try { -List msgs = null; -try { -msgs = putMsg(master, topicCount, msgPerTopic); -} catch (Exception e) { -e.printStackTrace(); -assertThat(true).isFalse(); -} - -// sleep to wait for consume queue has been constructed. -try { -Thread.sleep(1000); -} catch (InterruptedException e) { -e.printStackTrace(); -assertThat(true).isFalse(); -} +Thread.sleep(200); --- End diff -- At this time,there is no way to ensure CQ constructed except adding countdownlatch to CQ,if only in test,I think there is no need to do this. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139820#comment-16139820 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user vsair commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r134970377 --- Diff: store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java --- @@ -97,54 +110,46 @@ public MessageExtBrokerInner buildMessage() { @Test public void testGroupCommit() throws Exception { -long totalMsgs = 100; +long totalMsgs = 10; QUEUE_TOTAL = 1; MessageBody = StoreMessage.getBytes(); -MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); -messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8); -messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH); -MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig()); -boolean load = master.load(); -assertTrue(load); +for (long i = 0; i < totalMsgs; i++) { +messageStore.putMessage(buildMessage()); +} -master.start(); -verifyThatMasterIsFunctional(totalMsgs, master); +for (long i = 0; i < totalMsgs; i++) { +GetMessageResult result = messageStore.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); +assertThat(result).isNotNull(); +result.release(); +} +verifyThatMasterIsFunctional(totalMsgs, messageStore); } private void verifyThatMasterIsFunctional(long totalMsgs, MessageStore master) { -try { -for (long i = 0; i < totalMsgs; i++) { -master.putMessage(buildMessage()); -} - -for (long i = 0; i < totalMsgs; i++) { -GetMessageResult result = master.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); -assertThat(result).isNotNull(); -result.release(); - -} -} finally { -master.shutdown(); -master.destroy(); +for (long i = 0; i < totalMsgs; i++) { +master.putMessage(buildMessage()); +} + +for (long i = 0; i < totalMsgs; i++) { +GetMessageResult result = master.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); +assertThat(result).isNotNull(); +result.release(); + } } @Test public void testPullSize() throws Exception { -MessageStore messageStore = buildMessageStore(); -boolean load = messageStore.load(); -assertTrue(load); -messageStore.start(); String topic = "pullSizeTopic"; for (int i = 0; i < 32; i++) { MessageExtBrokerInner messageExtBrokerInner = buildMessage(); messageExtBrokerInner.setTopic(topic); messageExtBrokerInner.setQueueId(0); -PutMessageResult putMessageResult = messageStore.putMessage(messageExtBrokerInner); +messageStore.putMessage(messageExtBrokerInner); } //wait for consume queue build -Thread.sleep(100); +Thread.sleep(10); --- End diff -- Is it enough to build consume queue ? > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139821#comment-16139821 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user vsair commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r134969821 --- Diff: store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java --- @@ -43,15 +43,24 @@ private SocketAddress BornHost; private SocketAddress StoreHost; private byte[] MessageBody; +private MessageStore messageStore; @Before public void init() throws Exception { StoreHost = new InetSocketAddress(InetAddress.getLocalHost(), 8123); BornHost = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 0); + +messageStore = buildMessageStore(); +boolean load = messageStore.load(); +assertTrue(load); +messageStore.start(); } @After public void destory() { +messageStore.shutdown(); +messageStore.destroy(); --- End diff -- As i remember, method of destroy may not clean all files generated. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139818#comment-16139818 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user vsair commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r134970255 --- Diff: client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsitentHashTest.java --- @@ -92,9 +92,9 @@ public void testAllocate2() { @Test public void testRun100RandomCase() { -for (int i = 0; i < 100; i++) { -int consumerSize = new Random().nextInt(200) + 1;//1-200 -int queueSize = new Random().nextInt(100) + 1;//1-100 +for (int i = 0; i < 10; i++) { +int consumerSize = new Random().nextInt(20) + 1;//1-20 --- End diff -- Does it spend too much time to allocate queue ? If not, i think it does't matter to run 10 or 100 times. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139819#comment-16139819 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user vsair commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r134968491 --- Diff: store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java --- @@ -97,54 +110,46 @@ public MessageExtBrokerInner buildMessage() { @Test public void testGroupCommit() throws Exception { -long totalMsgs = 100; +long totalMsgs = 10; QUEUE_TOTAL = 1; MessageBody = StoreMessage.getBytes(); -MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); -messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8); -messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH); -MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig()); -boolean load = master.load(); -assertTrue(load); +for (long i = 0; i < totalMsgs; i++) { +messageStore.putMessage(buildMessage()); +} -master.start(); -verifyThatMasterIsFunctional(totalMsgs, master); +for (long i = 0; i < totalMsgs; i++) { +GetMessageResult result = messageStore.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); +assertThat(result).isNotNull(); +result.release(); +} +verifyThatMasterIsFunctional(totalMsgs, messageStore); } private void verifyThatMasterIsFunctional(long totalMsgs, MessageStore master) { -try { -for (long i = 0; i < totalMsgs; i++) { -master.putMessage(buildMessage()); -} - -for (long i = 0; i < totalMsgs; i++) { -GetMessageResult result = master.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); -assertThat(result).isNotNull(); -result.release(); - -} -} finally { -master.shutdown(); -master.destroy(); +for (long i = 0; i < totalMsgs; i++) { +master.putMessage(buildMessage()); +} + +for (long i = 0; i < totalMsgs; i++) { +GetMessageResult result = master.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); +assertThat(result).isNotNull(); +result.release(); + } } @Test public void testPullSize() throws Exception { -MessageStore messageStore = buildMessageStore(); -boolean load = messageStore.load(); -assertTrue(load); -messageStore.start(); String topic = "pullSizeTopic"; for (int i = 0; i < 32; i++) { MessageExtBrokerInner messageExtBrokerInner = buildMessage(); messageExtBrokerInner.setTopic(topic); messageExtBrokerInner.setQueueId(0); -PutMessageResult putMessageResult = messageStore.putMessage(messageExtBrokerInner); +messageStore.putMessage(messageExtBrokerInner); } //wait for consume queue build -Thread.sleep(100); +Thread.sleep(10); --- End diff -- Is 10ms enough to build consume queue? > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139783#comment-16139783 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user shroman commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r134962143 --- Diff: client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsitentHashTest.java --- @@ -92,9 +92,9 @@ public void testAllocate2() { @Test public void testRun100RandomCase() { -for (int i = 0; i < 100; i++) { -int consumerSize = new Random().nextInt(200) + 1;//1-200 -int queueSize = new Random().nextInt(100) + 1;//1-100 +for (int i = 0; i < 10; i++) { +int consumerSize = new Random().nextInt(20) + 1;//1-20 --- End diff -- @vongosling If you have stress tests for this, I think low numbers here are ok. Btw, how do/will you verify it? > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139678#comment-16139678 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user vongosling commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r134941453 --- Diff: client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsitentHashTest.java --- @@ -92,9 +92,9 @@ public void testAllocate2() { @Test public void testRun100RandomCase() { -for (int i = 0; i < 100; i++) { -int consumerSize = new Random().nextInt(200) + 1;//1-200 -int queueSize = new Random().nextInt(100) + 1;//1-100 +for (int i = 0; i < 10; i++) { +int consumerSize = new Random().nextInt(20) + 1;//1-20 --- End diff -- @shroman I would like to verify the program correction though the specific trick not iteration count, especially in unit-test, thoughts ? > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16131571#comment-16131571 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user shroman commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r133863841 --- Diff: client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsitentHashTest.java --- @@ -92,9 +92,9 @@ public void testAllocate2() { @Test public void testRun100RandomCase() { -for (int i = 0; i < 100; i++) { -int consumerSize = new Random().nextInt(200) + 1;//1-200 -int queueSize = new Random().nextInt(100) + 1;//1-100 +for (int i = 0; i < 10; i++) { +int consumerSize = new Random().nextInt(20) + 1;//1-20 --- End diff -- Guys, what's the point to reduce these numbers (in other tests in this PR too)? @vongosling @zhouxinyu IMO, we need to have a pretty high number for messages/queues/etc. in unit tests, because it is a large-scale messaging system. Unless it makes tests really slow. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16131565#comment-16131565 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user shroman commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r133863133 --- Diff: namesrv/src/test/java/org/apache/rocketmq/namesrv/NamesrvControllerTest.java --- @@ -1,46 +0,0 @@ -/* --- End diff -- Why is it deleted?? > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16131559#comment-16131559 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user shroman commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r133862502 --- Diff: broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java --- @@ -37,16 +37,14 @@ */ @Test public void testBrokerRestart() throws Exception { -for (int i = 0; i < 2; i++) { -BrokerController brokerController = new BrokerController( -new BrokerConfig(), -new NettyServerConfig(), -new NettyClientConfig(), -new MessageStoreConfig()); -assertThat(brokerController.initialize()); -brokerController.start(); -brokerController.shutdown(); -} +BrokerController brokerController = new BrokerController( --- End diff -- By changing this you change the expected behavior -- it is a check for proper `restart`. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128201#comment-16128201 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user lindzh commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r133344416 --- Diff: broker/src/test/java/org/apache/rocketmq/broker/filter/MessageStoreWithFilterTest.java --- @@ -76,6 +86,24 @@ } } +@Before +public void init() { +filterManager = ConsumerFilterManagerTest.gen(topicCount, msgPerTopic); +try { +master = gen(filterManager); +} catch (Exception e) { +e.printStackTrace(); --- End diff -- Yep,that's a good idea and this exception will be fixed at next commit. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127015#comment-16127015 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user vongosling commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r133153891 --- Diff: broker/src/test/java/org/apache/rocketmq/broker/filter/MessageStoreWithFilterTest.java --- @@ -76,6 +86,24 @@ } } +@Before +public void init() { +filterManager = ConsumerFilterManagerTest.gen(topicCount, msgPerTopic); +try { +master = gen(filterManager); +} catch (Exception e) { +e.printStackTrace(); --- End diff -- redundant code, when you use assert in your exception scenario, right ? > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16125161#comment-16125161 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user coveralls commented on the issue: https://github.com/apache/incubator-rocketmq/pull/145 [![Coverage Status](https://coveralls.io/builds/12817903/badge)](https://coveralls.io/builds/12817903) Coverage decreased (-0.06%) to 39.011% when pulling **7c6d268934bbbd490f0b2b6455b9f41766616f4e on lindzh:fix_test_exeception** into **332df78e2bb6caadfc6f471445ebb1f9d224 on apache:develop**. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124890#comment-16124890 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user zhouxinyu commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/145#discussion_r132838549 --- Diff: client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsitentHashTest.java --- @@ -95,14 +95,15 @@ public void testAllocate2() { @Test -public void testRun100RandomCase(){ -for(int i=0;i<100;i++){ -int consumerSize = new Random().nextInt(200)+1;//1-200 -int queueSize = new Random().nextInt(100)+1;//1-100 -testAllocate(queueSize,consumerSize); +public void testRun100RandomCase() { +for (int i = 0; i < 10; i++) { +int consumerSize = new Random().nextInt(20) + 1;//1-20 +int queueSize = new Random().nextInt(20) + 1;//1-20 +testAllocate(queueSize, consumerSize); try { Thread.sleep(1); -} catch (InterruptedException e) {} +} catch (InterruptedException e) { --- End diff -- Add exception to method signature is better~ > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16123144#comment-16123144 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user coveralls commented on the issue: https://github.com/apache/incubator-rocketmq/pull/145 [![Coverage Status](https://coveralls.io/builds/12792890/badge)](https://coveralls.io/builds/12792890) Coverage decreased (-0.2%) to 38.742% when pulling **c818e364fe910821913ffcc83414c1b77241a374 on lindzh:fix_test_exeception** into **ccc2235ae9509f101971915ba0521109a82894b0 on apache:develop**. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16123126#comment-16123126 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user coveralls commented on the issue: https://github.com/apache/incubator-rocketmq/pull/145 [![Coverage Status](https://coveralls.io/builds/12792667/badge)](https://coveralls.io/builds/12792667) Coverage decreased (-0.1%) to 38.925% when pulling **91a3ec9d2b2e3fa2942c6c45f28b4ccd8ee71041 on lindzh:fix_test_exeception** into **aa1c75774eb33fca9a1c3f036249b6c5b86ef0f5 on apache:develop**. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16123127#comment-16123127 ] ASF GitHub Bot commented on ROCKETMQ-264: - Github user coveralls commented on the issue: https://github.com/apache/incubator-rocketmq/pull/145 [![Coverage Status](https://coveralls.io/builds/12792667/badge)](https://coveralls.io/builds/12792667) Coverage decreased (-0.1%) to 38.925% when pulling **91a3ec9d2b2e3fa2942c6c45f28b4ccd8ee71041 on lindzh:fix_test_exeception** into **aa1c75774eb33fca9a1c3f036249b6c5b86ef0f5 on apache:develop**. > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ROCKETMQ-264) Unit test cost too long and there is exception in unit test
[ https://issues.apache.org/jira/browse/ROCKETMQ-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16123100#comment-16123100 ] ASF GitHub Bot commented on ROCKETMQ-264: - GitHub user lindzh opened a pull request: https://github.com/apache/incubator-rocketmq/pull/145 [ROCKETMQ-264] Fix unit test cost too long and exception in unit test When run mvn test , it cost too much time and some times there is exception in unit test and the test result is pass JIRA ticket https://issues.apache.org/jira/browse/ROCKETMQ-264 You can merge this pull request into a Git repository by running: $ git pull https://github.com/lindzh/incubator-rocketmq fix_test_exeception Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-rocketmq/pull/145.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #145 commit bcc65e5471d9821e0edb90f6f637e3034ed1da44 Author: lindzhDate: 2017-08-11T06:36:53Z [ROCKETMQ-231]Wrong Pull result sizebugfix Author: lindzh Closes #126 from lindzh/fix_consumer_pull_msg_size. commit aa1c75774eb33fca9a1c3f036249b6c5b86ef0f5 Author: lindzh Date: 2017-08-11T07:40:24Z [ROCKETMQ-254]Fix logger appender unit tests which cost too long Author: lindzh Closes #141 from lindzh/logger_appender_test. commit 1ae0693693da4a147f1bb3c122833f548c376b09 Author: lindzh Date: 2017-08-11T07:55:24Z Merge branch 'develop' of github.com:apache/incubator-rocketmq into develop commit 91a3ec9d2b2e3fa2942c6c45f28b4ccd8ee71041 Author: lindzh Date: 2017-08-11T09:30:07Z Fix unit test,delete invalid test and make test cost less time > Unit test cost too long and there is exception in unit test > --- > > Key: ROCKETMQ-264 > URL: https://issues.apache.org/jira/browse/ROCKETMQ-264 > Project: Apache RocketMQ > Issue Type: Improvement >Reporter: lindzh >Assignee: vongosling > > When run mvn test , it cost too much time and some times there is exception > in unit test and the test result is pass -- This message was sent by Atlassian JIRA (v6.4.14#64029)