-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix test for Win & filter tests requiring remote resources #1127
Conversation
…cleanups Flag tests with RequiresRemoteResource to enable filtering Remove unused imports Update junit version Log useful info and error conditions
iteration++; | ||
iteration++; | ||
loop = !result && iteration < totalIterations; | ||
if (loop) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only wait if we're going to loop again
@@ -37,7 +37,7 @@ | |||
public static final String CLEAN = "clean"; | |||
public static final String REMOVE_VOLUMES = "removeVolumes"; | |||
public static final String CLEAN_BUILD_IMAGE = "cleanBuildImage"; | |||
static final String DIND_RESOLUTION = "dockerInsideDockerResolution"; | |||
public static final String DIND_RESOLUTION = "dockerInsideDockerResolution"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required outside
|
||
String machineName = config.get(CubeDockerConfiguration.DOCKER_MACHINE_NAME); | ||
String machineUrl = CubeDockerConfiguration.resolveUrl(machineVersion); | ||
|
||
if (!dockerMachineFileExist) { | ||
dockerMachineFile.getParentFile().mkdirs(); | ||
final File parentFile = dockerMachineFile.getParentFile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safer
System.setProperty(String.format("%s.ip", cubePrefix), bindings.getIP()); | ||
System.setProperty(String.format("%s.internal.ip", cubePrefix), bindings.getInternalIP()); | ||
|
||
final String ip = bindings.getIP(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value or empty string
@@ -519,6 +506,16 @@ private void initializeCube() { | |||
} | |||
cubeController.create(containerName); | |||
cubeController.start(containerName); | |||
logger.log(Level.INFO, "Started container: " + getContainerInfo(containerName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really useful info if available
|
||
this.dockerClient = buildDockerClient(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than exposing this outside it made sense to me to add a shutdown hook for this important cleanup.
@@ -1168,6 +1182,10 @@ public URI getDockerUri() { | |||
return dockerUri; | |||
} | |||
|
|||
public boolean isDockerInsideDockerResolution() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Object is passed around (config is not) and providing this here is useful to understand the client context.
@@ -57,11 +59,11 @@ | |||
Top top; | |||
|
|||
private static Matcher<String> defaultDockerMachineCertPath() { | |||
return containsString(".docker/machine/machines"); | |||
return containsString(".docker" + File.separator + "machine" + File.separator + "machines"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Win fix, really need to ensure such paths are independent everywhere.
} | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is always the fallback
import org.junit.runner.RunWith; | ||
|
||
@RunWith(Arquillian.class) | ||
@Category({RequiresRemoteResource.class}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows tests to be excluded that make real remote calls, which just breaks when behind a corporate firewall.
@@ -26,12 +26,11 @@ | |||
</plugin> | |||
<plugin> | |||
<artifactId>maven-surefire-plugin</artifactId> | |||
<version>2.19.1</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Managed higher up
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-surefire-provider</artifactId> | ||
<version>1.0.2</version> | ||
<version>1.3.2</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Junit 5 doesn't need Java 7 backwards compatibility
import java.util.logging.Logger; | ||
|
||
import static org.arquillian.cube.docker.impl.client.reporter.DockerEnvironmentReportKey.*; | ||
import static org.arquillian.cube.docker.impl.client.reporter.DockerEnvironmentReportKey.DOCKER_API_VERSION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot more import cleanups, but it'd make this PR crazy.
.hasName(DOCKER_ENVIRONMENT) | ||
.hasNumberOfSubReports(1) | ||
.hasEntriesContaining( | ||
new KeyValueEntry(DOCKER_COMPOSITION_SCHEMA, new FileEntry("reports" + File.separatorChar + "schemas" + File.separatorChar + "docker_composition.png")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cross platform
Trivial cleanups
Short description of what this resolves:
Fix tests on Win and allow filtering of tests that attempt to access remote resources (eg, blocked by a firewall).
Changes proposed in this pull request:
Preparation of #1107 - Which is a much larger WIP PR for later