Skip to content

Commit

Permalink
randomize the directory name and remove the exception check
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczi committed Jan 10, 2018
1 parent b5b528b commit 0779d60
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.Version;
import org.elasticsearch.cli.ExitCodes;
Expand Down Expand Up @@ -433,10 +434,12 @@ public void testMalformedUrlNotMaven() throws Exception {

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

public void testUnknownPlugin() throws Exception {
Expand Down

0 comments on commit 0779d60

Please sign in to comment.