Fix SymbolicLinkPreservingTarIT on windows (#46908)

Broken path comparison on windows:
 https://scans.gradle.com/s/7y3zl23orfp7w/tests/nr3ff3qzwqzsw-xfh7lvi5orvq4
With the fix:
 https://gradle-enterprise.elastic.co/s/4dcc2nv3haaqw
This commit is contained in:
Alpar Torok 2019-09-20 17:26:53 +03:00
parent 402fb5e882
commit 0294b8fc60
1 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
public class SymbolicLinkPreservingTarIT extends GradleIntegrationTestCase { public class SymbolicLinkPreservingTarIT extends GradleIntegrationTestCase {
@ -92,18 +93,27 @@ public class SymbolicLinkPreservingTarIT extends GradleIntegrationTestCase {
fileEntry = true; fileEntry = true;
} else if (entry.getName().equals("real-folder/link-to-file")) { } else if (entry.getName().equals("real-folder/link-to-file")) {
assertTrue(entry.isSymbolicLink()); assertTrue(entry.isSymbolicLink());
assertThat(entry.getLinkName(), equalTo("./file")); assertThat(
entry.getLinkName(),
anyOf(equalTo("./file"), equalTo(".\\file"))
);
linkToFileEntry = true; linkToFileEntry = true;
} else if (entry.getName().equals("link-in-folder/")) { } else if (entry.getName().equals("link-in-folder/")) {
assertTrue(entry.isDirectory()); assertTrue(entry.isDirectory());
linkInFolderEntry = true; linkInFolderEntry = true;
} else if (entry.getName().equals("link-in-folder/link-to-file")) { } else if (entry.getName().equals("link-in-folder/link-to-file")) {
assertTrue(entry.isSymbolicLink()); assertTrue(entry.isSymbolicLink());
assertThat(entry.getLinkName(), equalTo("../real-folder/file")); assertThat(
entry.getLinkName(),
anyOf(equalTo("../real-folder/file"), equalTo("..\\real-folder\\file"))
);
linkInFolderLinkToFileEntry = true; linkInFolderLinkToFileEntry = true;
} else if (entry.getName().equals("link-to-real-folder")) { } else if (entry.getName().equals("link-to-real-folder")) {
assertTrue(entry.isSymbolicLink()); assertTrue(entry.isSymbolicLink());
assertThat(entry.getLinkName(), equalTo("./real-folder")); assertThat(
entry.getLinkName(),
anyOf(equalTo("./real-folder"), equalTo(".\\real-folder"))
);
linkToRealFolderEntry = true; linkToRealFolderEntry = true;
} else { } else {
throw new GradleException("unexpected entry [" + entry.getName() + "]"); throw new GradleException("unexpected entry [" + entry.getName() + "]");