Skip to content

Commit 0779d60

Browse files
committed
randomize the directory name and remove the exception check
1 parent b5b528b commit 0779d60

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/InstallPluginCommandTests.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
2323
import com.google.common.jimfs.Configuration;
2424
import com.google.common.jimfs.Jimfs;
25+
import org.apache.lucene.util.IOUtils;
2526
import org.apache.lucene.util.LuceneTestCase;
2627
import org.elasticsearch.Version;
2728
import org.elasticsearch.cli.ExitCodes;
@@ -433,10 +434,12 @@ public void testMalformedUrlNotMaven() throws Exception {
433434

434435
public void testFileNotMaven() throws Exception {
435436
Tuple<Path, Environment> env = createEnv(fs, temp);
436-
// has two colons, so it appears similar to maven coordinates
437-
FileNotFoundException e = expectThrows(FileNotFoundException.class,
438-
() -> installPlugin("file:C:\\path\\to\\plugin\\does_not_exists.zip", env.v1()));
439-
assertTrue(e.getMessage(), e.getMessage().startsWith("C:\\path\\to\\plugin\\does_not_exists.zip"));
437+
String dir = randomAlphaOfLength(10) + ":" + randomAlphaOfLength(5) + "\\" + randomAlphaOfLength(5);
438+
Exception e = expectThrows(Exception.class,
439+
// has two colons, so it appears similar to maven coordinates
440+
() -> installPlugin("file:" + dir, env.v1()));
441+
assertFalse(e.getMessage(), e.getMessage().contains("maven.org"));
442+
assertTrue(e.getMessage(), e.getMessage().contains(dir));
440443
}
441444

442445
public void testUnknownPlugin() throws Exception {

0 commit comments

Comments
 (0)