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 8760E6B40 for ; Wed, 1 Jun 2011 11:02:31 +0000 (UTC) Received: (qmail 1399 invoked by uid 500); 1 Jun 2011 11:02:29 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 1338 invoked by uid 500); 1 Jun 2011 11:02:29 -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 1330 invoked by uid 99); 1 Jun 2011 11:02:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jun 2011 11:02:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_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; Wed, 01 Jun 2011 11:02:28 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 9D875ED111 for ; Wed, 1 Jun 2011 11:01:47 +0000 (UTC) Date: Wed, 1 Jun 2011 11:01:47 +0000 (UTC) From: "Shai Erera (JIRA)" To: dev@lucene.apache.org Message-ID: <1118430206.59206.1306926107641.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <28535796.36761291902781163.JavaMail.jira@thor> Subject: [jira] [Commented] (SOLR-2279) Add a MockDirectoryFactory (or similar) for Solr tests 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/SOLR-2279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042103#comment-13042103 ] Shai Erera commented on SOLR-2279: ---------------------------------- I debug-traced MultiCoreEmbeddedTest and this is what I found: the test opens two indexes, one under a temp directory, and one under trunk/solr/example/multicore/core0/data/index. The one under temp is populated alright (and exists), while the one under solr/example (to clarify -- this directory is expected to be found on the checkout, so it seems) is empty, and hence the test fails on IndexNotFoundException. I don't understand the test, so I cannot fix it. Just put it here in case someone else knows this code. I don't understand why this test passes w/ RAMDirectoryFactory. Also, under solr/example/multicore/core0/conf, solrconfig.xml lists dirFactory to be StandardDirFactory. I don't know what are the implications of this on the test, but pointing it out as well. Hope this info helps someone debug and fix the test :). > Add a MockDirectoryFactory (or similar) for Solr tests > ------------------------------------------------------ > > Key: SOLR-2279 > URL: https://issues.apache.org/jira/browse/SOLR-2279 > Project: Solr > Issue Type: Test > Components: Build > Reporter: Robert Muir > Assignee: Robert Muir > Fix For: 3.3, 4.0 > > Attachments: SOLR-2279.patch, SOLR-2279.patch, SOLR-2279.patch > > > Currently, all Lucene tests open directories with newDirectory() [and soon-to-be added newFSDirectory() which always ensures the directory returned is an FSDir subclass, see LUCENE-2804 for this]. Additionally the directory is wrapped with MockDirectoryWrapper. > This has a number of advantages: > * By default the directory implementation is random, but you can easily specify a specific impl e.g. -Dtests.directory=MMapDirectory. When proposing a change to one of our directory implementations, we can run all tests with it this way... it would be good for Solr tests to respect this too. > * The test framework (LuceneTestCase before/afterclass) ensures that these directories are properly closed, if not, it causes the test to fail with a stacktrace of where you > first opened the directory. > * MockDirectoryWrapper.close() then ensures that there are no resource leaks by default, when you open a file they save the stacktrace of where you opened it from. If you try to close the directory without say, closing an IndexReader, it fails with the stacktrace of where you opened the reader from. This is helpful for tracking down resource leaks. Currently Solr warns if it cannot delete its test temporary directory, but this is better since you know exactly where the resource leak came from. This can be disabled with an optional setter which we should probably expose for some tests that have known leaks like SpellCheck. > * MockDirectoryWrapper enforce consistent test behavior on any operating system, as it won't be dependent on the return value of FSDirectory.open > * MockDirectoryWrapper has a number of other checks and features, such as simulating a crash, simulating disk full, emulating windows (where you can't delete open files), etc. -- 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