Skip to content

Commit

Permalink
Fix setup code in GeoIpCliTests (#71156)
Browse files Browse the repository at this point in the history
Instead of creating directories manually under temp dir we should simply use createTempDir() twice. This should make Windows be able to delete directories correctly.

This PR also removes unused method.

Fixes #71145
  • Loading branch information
probakowski authored Apr 1, 2021
1 parent 3d784f8 commit ac0fc01
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.cli.MockTerminal;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.xcontent.DeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -36,7 +34,6 @@
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;

@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/71145")
@LuceneTestCase.SuppressFileSystems(value = "ExtrasFS") // Don't randomly add 'extra' files to directory.
public class GeoIpCliTests extends LuceneTestCase {

Expand All @@ -45,16 +42,8 @@ public class GeoIpCliTests extends LuceneTestCase {

public void setUp() throws Exception {
super.setUp();
Path tempPath = createTempDir();
source = tempPath.resolve("source");
target = tempPath.resolve("target");
Files.createDirectory(source);
Files.createDirectory(target);
}

@SuppressForbidden(reason = "process builder requires File for directory")
private File getTargetFile() {
return target.toFile();
source = createTempDir();
target = createTempDir();
}

public void testNoSource() throws Exception {
Expand Down

0 comments on commit ac0fc01

Please sign in to comment.