Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E5F508D5B for ; Fri, 26 Aug 2011 15:08:54 +0000 (UTC) Received: (qmail 82503 invoked by uid 500); 26 Aug 2011 15:08:53 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 82326 invoked by uid 500); 26 Aug 2011 15:08:52 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 82225 invoked by uid 99); 26 Aug 2011 15:08:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2011 15:08:52 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2011 15:08:50 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6806CD00E6 for ; Fri, 26 Aug 2011 15:08:30 +0000 (UTC) Date: Fri, 26 Aug 2011 15:08:30 +0000 (UTC) From: "Robert Muir (JIRA)" To: dev@lucene.apache.org Message-ID: <577498415.17749.1314371310422.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <575038273.16076.1314324449073.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (LUCENE-3402) LuceneTestCase shouldn't go crazy if a test fails in an @AfterClass annotated method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-3402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13091817#comment-13091817 ] Robert Muir commented on LUCENE-3402: ------------------------------------- I'm gonna give this patch a try, if things go crazy i'll back it out. > LuceneTestCase shouldn't go crazy if a test fails in an @AfterClass annotated method > ------------------------------------------------------------------------------------ > > Key: LUCENE-3402 > URL: https://issues.apache.org/jira/browse/LUCENE-3402 > Project: Lucene - Java > Issue Type: Bug > Reporter: Robert Muir > Attachments: LUCENE-3402.patch, LUCENE-3402.patch > > > An example can be seen here: http://sierranevada.servebeer.com/1314308641.log > The general problem is this: the assertions and cleanups in lucenetestcase's afterclass should be reordered, and have better error handling. > In this particular case these were the steps that happened: > # AutoCommitTest didn't close its searchers, so SolrTestCaseJ4 threw an assertion exception in its @AfterClass method. > # Because the searcher wasn't closed, LuceneTestCase threw an assertion exception about unclosed directories/file handles in its afterClass. Even though the test had already "failed" it ran this assertion because testsFailed is false, since our TestWatchMan isnt aware of failures that happen in @AfterClass methods :( > # Because it threw this exception, it never made it to the part where it resets the random, so the next test blew up in its BeforeClass. > To add insult to injury, all this happened but we didnt get a random seed printed, so we cant even hope to reproduce the situation. > After discussion with hossman, we came up with some ideas on how to improve this, and I'm adding some i just thought of, too: > # try to divide up these assertions and cleanups in LuceneTestCase: we could use multiple @AfterClass-annotated methods but then i'm not sure we can control the order, which is scary. But one safe thing to do is to put these pieces of code in little methods and afterclass can handle this stuff with try/finally. > # think about exposing the testsFailed variable for subclasses that do assertions in their @AfterClasses. otherwise you might not get a random seed, which is bad. > # think about upgrading junit, because I know from experimentation that the TestWatchMan (or whatever its replacement is) can "see more" of the test lifecycle and this would probably make a lot of this much cleaner. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org