FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix unit test failures on Windows by aroskuski · Pull Request #1804 · docker-java/docker-java · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.github.dockerjava.api.model.AuthConfigurations;
import com.google.common.io.Resources;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Test;

import java.io.File;
Expand Down Expand Up @@ -97,8 +98,11 @@ public void emptyHost() {

DefaultDockerClientConfig config = buildConfig(env, new Properties());

String expectedDefaultHost = SystemUtils.IS_OS_WINDOWS ? DefaultDockerClientConfig.WINDOWS_DEFAULT_DOCKER_HOST
: DefaultDockerClientConfig.DEFAULT_DOCKER_HOST;

assertEquals(
DefaultDockerClientConfig.DEFAULT_DOCKER_HOST,
expectedDefaultHost,
config.getDockerHost().toString()
);
}
Expand All @@ -119,7 +123,9 @@ public void defaults() throws Exception {
DefaultDockerClientConfig config = buildConfig(Collections.<String, String> emptyMap(), systemProperties);

// then the cert path is as expected
assertEquals(config.getDockerHost(), URI.create("unix:///var/run/docker.sock"));
URI expectedDefaultURI = SystemUtils.IS_OS_WINDOWS ? URI.create(DefaultDockerClientConfig.WINDOWS_DEFAULT_DOCKER_HOST)
: URI.create(DefaultDockerClientConfig.DEFAULT_DOCKER_HOST);
assertEquals(config.getDockerHost(), expectedDefaultURI);
assertEquals(config.getRegistryUsername(), "someUserName");
assertEquals(config.getRegistryUrl(), AuthConfig.DEFAULT_SERVER_ADDRESS);
assertEquals(config.getApiVersion(), RemoteApiVersion.unknown());
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand All @@ -22,6 +23,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;

public class CompressArchiveUtilTest {

Expand Down Expand Up @@ -69,6 +71,7 @@ public void tarWithExecutableFileAsInput() throws Exception {

@Test
public void tarWithSymbolicLinkFileAsInput() throws IOException {
assumeSymbolicLinksAreUnrestrictedByDefault();
Path archiveSourceFile = tempFolder.getRoot().toPath().resolve("symlinkFile");
Path linkTargetFile = tempFolder.newFile("link-target").toPath();
Files.createSymbolicLink(archiveSourceFile, linkTargetFile);
Expand Down Expand Up @@ -139,6 +142,7 @@ public void tarWithfolderAsInputAndNestedExecutableFile() throws Exception {

@Test
public void tarWithfolderAsInputAndNestedSymbolicLinkFile() throws Exception {
assumeSymbolicLinksAreUnrestrictedByDefault();
Path archiveSourceDir = tempFolder.newFolder("archive-source").toPath();
Path linkTargetFile = tempFolder.newFile("link-target").toPath();
Path symlinkFile = archiveSourceDir.resolve("symlinkFile");
Expand All @@ -160,6 +164,7 @@ public void tarWithfolderAsInputAndNestedSymbolicLinkFile() throws Exception {

@Test
public void tarWithfolderAsInputAndNestedSymbolicLinkDir() throws Exception {
assumeSymbolicLinksAreUnrestrictedByDefault();
Path archiveSourceDir = tempFolder.newFolder("archive-source").toPath();
Path linkTargetDir = tempFolder.newFolder("link-target").toPath();
Path symlinkFile = archiveSourceDir.resolve("symlinkFile");
Expand Down Expand Up @@ -204,6 +209,7 @@ public void archiveTARFilesWithExecutableFile() throws Exception {

@Test
public void archiveTARFilesWithSymbolicLinkFile() throws Exception {
assumeSymbolicLinksAreUnrestrictedByDefault();
Path linkTargetFile = tempFolder.newFile("link-target").toPath();
Path symlinkFile = tempFolder.getRoot().toPath().resolve("symlinkFile");
Files.createSymbolicLink(symlinkFile, linkTargetFile);
Expand All @@ -215,6 +221,7 @@ public void archiveTARFilesWithSymbolicLinkFile() throws Exception {

@Test
public void archiveTARFilesWithSymbolicLinkDir() throws Exception {
assumeSymbolicLinksAreUnrestrictedByDefault();
Path linkTargetDir = tempFolder.newFolder("link-target").toPath();
Path symlinkFile = tempFolder.getRoot().toPath().resolve("symlinkFile");
Files.createSymbolicLink(symlinkFile, linkTargetDir);
Expand Down Expand Up @@ -317,4 +324,8 @@ private static int getNumberOfEntryInArchive(File tarArchive) throws IOException
}
return numberOfEntries;
}

private static void assumeSymbolicLinksAreUnrestrictedByDefault(){
assumeFalse(SystemUtils.IS_OS_WINDOWS);
}
}

Back | FazBrowse Home | New Git URL