You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2019/12/06 16:59:59 UTC
[lucene-solr] branch master updated: SOLR-13988: Harden
CreateCollectionCleanupTest
This is an automated email from the ASF dual-hosted git repository.
erick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 106b9d6 SOLR-13988: Harden CreateCollectionCleanupTest
106b9d6 is described below
commit 106b9d686602b05f02139e296ea3a388a5fac406
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Fri Dec 6 11:59:53 2019 -0500
SOLR-13988: Harden CreateCollectionCleanupTest
---
.../apache/solr/cloud/CreateCollectionCleanupTest.java | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/cloud/CreateCollectionCleanupTest.java b/solr/core/src/test/org/apache/solr/cloud/CreateCollectionCleanupTest.java
index 733a4a1..3f8326c 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CreateCollectionCleanupTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CreateCollectionCleanupTest.java
@@ -21,11 +21,11 @@ import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
+import java.nio.file.Path;
import java.util.Properties;
+import org.apache.solr.client.solrj.impl.BaseHttpSolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.client.solrj.response.RequestStatusState;
import org.apache.solr.common.params.CoreAdminParams;
import org.junit.BeforeClass;
@@ -77,10 +77,12 @@ public class CreateCollectionCleanupTest extends SolrCloudTestCase {
CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection(collectionName,"conf1",1,1);
Properties properties = new Properties();
- properties.put(CoreAdminParams.DATA_DIR, "/some_invalid_dir/foo");
+ Path tmpDir = createTempDir();
+ tmpDir.toFile().setWritable(false);
+ properties.put(CoreAdminParams.DATA_DIR, tmpDir.toString());
create.setProperties(properties);
- expectThrows(HttpSolrClient.RemoteSolrException.class, () -> {
- CollectionAdminResponse rsp = create.process(cloudClient);
+ expectThrows(BaseHttpSolrClient.RemoteSolrException.class, () -> {
+ create.process(cloudClient);
});
// Confirm using LIST that the collection does not exist
@@ -99,7 +101,9 @@ public class CreateCollectionCleanupTest extends SolrCloudTestCase {
CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection(collectionName,"conf1",1,1);
Properties properties = new Properties();
- properties.put(CoreAdminParams.DATA_DIR, "/some_invalid_dir/foo2");
+ Path tmpDir = createTempDir();
+ tmpDir.toFile().setWritable(false);
+ properties.put(CoreAdminParams.DATA_DIR, tmpDir.toString());
create.setProperties(properties);
create.setAsyncId("testAsyncCreateCollectionCleanup");
create.process(cloudClient);