You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2015/05/29 01:02:44 UTC

svn commit: r1682353 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/core/ solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java

Author: rmuir
Date: Thu May 28 23:02:43 2015
New Revision: 1682353

URL: http://svn.apache.org/r1682353
Log:
LUCENE-6507: fix test bug to not double-obtain. testDoubleObtain already tests that

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java?rev=1682353&r1=1682352&r2=1682353&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java Thu May 28 23:02:43 2015
@@ -25,6 +25,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.lucene.store.Lock;
 import org.apache.lucene.store.LockObtainFailedException;
+import org.apache.lucene.util.IOUtils;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.cloud.hdfs.HdfsTestUtil;
 import org.apache.solr.util.BadHdfsThreadsFilter;
@@ -33,6 +34,7 @@ import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
 
 @ThreadLeakFilters(defaultFilters = true, filters = {
@@ -72,13 +74,18 @@ public class HdfsLockFactoryTest extends
     Lock lock = dir.makeLock("testlock");
     boolean success = lock.obtain();
     assertTrue("We could not get the lock when it should be available", success);
-    success = lock.obtain();
+    Lock lock2 = dir.makeLock("testlock");
+    success = lock2.obtain();
     assertFalse("We got the lock but it should be unavailble", success);
-    lock.close();
+    IOUtils.close(lock, lock2);
+    // now repeat after close()
+    lock = dir.makeLock("testlock");
     success = lock.obtain();
     assertTrue("We could not get the lock when it should be available", success);
-    success = lock.obtain();
+    lock2 = dir.makeLock("testlock");
+    success = lock2.obtain();
     assertFalse("We got the lock but it should be unavailble", success);
+    IOUtils.close(lock, lock2);
     dir.close();
   }