2015-05-19 87 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