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:05:24 UTC
svn commit: r1682354 - in /lucene/dev/branches/lucene_solr_5_2: ./ solr/
solr/core/
solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
Author: rmuir
Date: Thu May 28 23:05:24 2015
New Revision: 1682354
URL: http://svn.apache.org/r1682354
Log:
LUCENE-6507: fix test bug to not double-obtain. testDoubleObtain already tests that
Modified:
lucene/dev/branches/lucene_solr_5_2/ (props changed)
lucene/dev/branches/lucene_solr_5_2/solr/ (props changed)
lucene/dev/branches/lucene_solr_5_2/solr/core/ (props changed)
lucene/dev/branches/lucene_solr_5_2/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
Modified: lucene/dev/branches/lucene_solr_5_2/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_2/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java?rev=1682354&r1=1682353&r2=1682354&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_2/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java (original)
+++ lucene/dev/branches/lucene_solr_5_2/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java Thu May 28 23:05:24 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();
}