2015-05-19 47 views
1

在编译卡桑德拉单元测试用例我一直在一个错误。其中一项测试有时会超时。虽然https://issues.apache.org/jira/browse/CASSANDRA-8981指出此问题已在2.1.5版中得到解决,但我仍然遇到此问题。使用jdk1.8从源代码构建cassandra 2.1.5。以下是详细内容:卡桑德拉IndexSummaryManagerTest单元测试用例超时错误

[junit] Testsuite: org.apache.cassandra.io.sstable.IndexSummaryManagerTest 
[junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec 
[junit] 
[junit] Testcase: org.apache.cassandra.io.sstable.IndexSummaryManagerTest:testCompactionRace: Caused an ERROR 
[junit] Timeout occurred. Please note the time in the report does not reflect the time until the timeout. 
[junit] junit.framework.AssertionFailedError: Timeout occurred. Please note the time in the report does not reflect the time until the timeout. 
[junit]  at java.lang.Thread.run(Thread.java:745) 
[junit] 
[junit] 
[junit] Test org.apache.cassandra.io.sstable.IndexSummaryManagerTest FAILED (timeout) 
[junit] Testsuite: org.apache.cassandra.io.sstable.IndexSummaryTest 
[junit] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.193 sec 

回答

1

参加卡桑德拉测试的讨论最好的地方可能是在irc.freenode.net上的IRC频道#卡桑德拉-dev的[0] - 卡桑德拉开发人员和测试工程师都挂出那里并每天讨论这类事情:)偶尔我偶尔会碰巧浏览Cassandra标签,并且遇到了最近的几个最近的测试问题。

关于您的特定测试错误,我简要介绍了最近的CI历史记录[1],但没有看到最近的超时 - 这并不意味着您的帮助无法改进测试,如果您发现了一个问题。

我不知道为什么系统的类型,你正在测试,但也许是I/O速度很慢,这可能使测试的时间比默认为60第二个测试超时时间长。再次

(cassandra-2.1 *)[email protected]:~/git/cassandra$ git diff 
diff --git a/build.xml b/build.xml 
index e197696..2d5e20a 100644 
--- a/build.xml 
+++ b/build.xml 
@@ -91,7 +91,7 @@ 
    <property name="maven-repository-url" value="https://repository.apache.org/content/repositories/snapshots"/> 
    <property name="maven-repository-id" value="apache.snapshots.https"/> 

- <property name="test.timeout" value="60000" /> 
+ <property name="test.timeout" value="120000" /> 
    <property name="test.long.timeout" value="600000" /> 

    <!-- default for cql tests. Can be override by -Dcassandra.test.use_prepared=false --> 

构建和测试(输出剪断):

(cassandra-2.1 *)[email protected]:~/cassandra$ ant clean jar 
<...> 
(cassandra-2.1 *)[email protected]:~/cassandra$ ant test -Dtest.name=IndexSummaryManagerTest 
<...> 
testlist: 
    [echo] running test bucket 0 tests 
    [mkdir] Created dir: /home/mshuler/cassandra/build/test/cassandra 
    [mkdir] Created dir: /home/mshuler/cassandra/build/test/output 
    [junit] WARNING: multiple versions of ant detected in path for junit 
    [junit]   jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/Project.class 
    [junit]  and jar:file:/home/mshuler/cassandra/build/lib/jars/ant-1.6.5.jar!/org/apache/tools/ant/Project.class 
    [junit] Testsuite: org.apache.cassandra.io.sstable.IndexSummaryManagerTest 
    [junit] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.737 sec 
    [junit] 

BUILD SUCCESSFUL 
Total time: 18 seconds 

如果仍然让我们加倍 - 通过设置较高的build.xml超时,看看测试至少最终把启动有问题,看一下测试system.log文件,看看你是否可以理清你的问题可能是什么。您会在build/test/logs/system.log找到该日志文件。

如果你能确定一个问题并且可以提供再现步骤,那么打开一个JIRA票据......实际上,它看起来像我在这个测试期间重新打开了一个不同的JIRA,用于测试所有蚂蚁目标:https://issues.apache.org/jira/browse/CASSANDRA-9271

我会继续和张贴这个答案,因为上面有至少一对夫妇的工具,你应该在你的测试工具箱。尽管欢迎来IRC聊天!

[0] http://freenode.net/

[1] http://cassci.datastax.com/job/cassandra-2.1_utest/lastCompletedBuild/testReport/org.apache.cassandra.io.sstable/IndexSummaryManagerTest/history/

+0

非常感谢你的帮助。我一直在增加超时时间,测试终于成功了,测试成功需要6分钟。我在运行在我的mac上的虚拟机上的docker中运行它。正如你所建议的那样,我将加入IRC频道并从那里获得投入。 – Sandeep

+0

此外,我已经注意到这些行在日志中重复测试执行时间的主要部分: DEBUG [pool-3-thread-1] 2015-05-19 18:16:07,136完成索引摘要的大小调整;当前使用的近似内存:0.09203243255615234 MB DEBUG [pool-3-thread-2] 2015-05-19 18:16:07,137完成索引摘要的大小调整;当前使用的近似内存:0.09203243255615234 MB DEBUG [pool-3-thread-1] 2015-05-19 18:16:07,137开始重新分配65个sstables的索引摘要,内存池大小为7 MB;使用的当前间隔是0.09203243255615234 MB – Sandeep