SOLR-13988: Harden CreateCollectionCleanupTest. Incorporate Dawid Weiss' suggestion for windows

This commit is contained in:
Erick Erickson 2019-12-06 19:10:27 -05:00
parent 155ab116a2
commit 7d5d44a3c4
1 changed files with 5 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;
import org.apache.solr.client.solrj.impl.BaseHttpSolrClient;
@ -78,7 +79,8 @@ public class CreateCollectionCleanupTest extends SolrCloudTestCase {
Properties properties = new Properties();
Path tmpDir = createTempDir();
tmpDir.toFile().setWritable(false);
tmpDir = tmpDir.resolve("foo");
Files.createFile(tmpDir);
properties.put(CoreAdminParams.DATA_DIR, tmpDir.toString());
create.setProperties(properties);
expectThrows(BaseHttpSolrClient.RemoteSolrException.class, () -> {
@ -102,7 +104,8 @@ public class CreateCollectionCleanupTest extends SolrCloudTestCase {
Properties properties = new Properties();
Path tmpDir = createTempDir();
tmpDir.toFile().setWritable(false);
tmpDir = tmpDir.resolve("foo");
Files.createFile(tmpDir);
properties.put(CoreAdminParams.DATA_DIR, tmpDir.toString());
create.setProperties(properties);
create.setAsyncId("testAsyncCreateCollectionCleanup");