-
Notifications
You must be signed in to change notification settings - Fork 23
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
Removing throws Exception. Fixes #194 #200
Open
honza-kasik
wants to merge
3
commits into
jboss-eap-qe:master
Choose a base branch
from
honza-kasik:docker-improv
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
36 changes: 36 additions & 0 deletions
36
tooling-docker/src/main/java/org/jboss/eap/qe/ts/common/docker/Container.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jboss.eap.qe.ts.common.docker; | ||
|
||
/** | ||
* Describes public interface available for a container (not an Arquillian one but the operating system level | ||
* virtualization unit). | ||
*/ | ||
public interface Container { | ||
|
||
/** | ||
* Start a previously stopped or killed container | ||
*/ | ||
void start() throws ContainerStartException; | ||
|
||
/** | ||
* Check if container is running. Container in running state doesn't mean that the initialization is done and | ||
* container is ready for work. | ||
* | ||
* @return Returns true if docker container is running. | ||
*/ | ||
boolean isRunning(); | ||
|
||
/** | ||
* Stop this docker container. | ||
* | ||
* @throws ContainerStopException thrown when the stop fails. This might mean that the container is still running. | ||
*/ | ||
void stop() throws ContainerStopException; | ||
|
||
/** | ||
* Kill this container. | ||
* | ||
* @throws ContainerKillException thrown when the kill fails. This might mean that the container is still running. | ||
*/ | ||
void kill() throws ContainerKillException; | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
tooling-docker/src/main/java/org/jboss/eap/qe/ts/common/docker/ContainerKillException.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.jboss.eap.qe.ts.common.docker; | ||
|
||
/** | ||
* An exception thrown when killing a container fails | ||
*/ | ||
public class ContainerKillException extends Exception { | ||
|
||
public ContainerKillException() { | ||
super(); | ||
} | ||
|
||
public ContainerKillException(String message) { | ||
super(message); | ||
} | ||
|
||
public ContainerKillException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public ContainerKillException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
7 changes: 6 additions & 1 deletion
7
...ker/src/main/java/org/jboss/eap/qe/ts/common/docker/ContainerReadyConditionException.java
This file contains 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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
package org.jboss.eap.qe.ts.common.docker; | ||
|
||
public class ContainerReadyConditionException extends RuntimeException { | ||
/** | ||
* An exception thrown when checking for container readiness fails | ||
*/ | ||
public class ContainerReadyConditionException extends Exception { | ||
|
||
public ContainerReadyConditionException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
tooling-docker/src/main/java/org/jboss/eap/qe/ts/common/docker/ContainerRemoveException.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.jboss.eap.qe.ts.common.docker; | ||
|
||
/** | ||
* An exception thrown when container removal fails | ||
*/ | ||
public class ContainerRemoveException extends Exception { | ||
|
||
public ContainerRemoveException() { | ||
super(); | ||
} | ||
|
||
public ContainerRemoveException(String message) { | ||
super(message); | ||
} | ||
|
||
public ContainerRemoveException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public ContainerRemoveException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tooling-docker/src/main/java/org/jboss/eap/qe/ts/common/docker/ContainerStartException.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.jboss.eap.qe.ts.common.docker; | ||
|
||
/** | ||
* An exception thrown when container start fails | ||
*/ | ||
public class ContainerStartException extends Exception { | ||
|
||
public ContainerStartException() { | ||
super(); | ||
} | ||
|
||
public ContainerStartException(String message) { | ||
super(message); | ||
} | ||
|
||
public ContainerStartException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public ContainerStartException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tooling-docker/src/main/java/org/jboss/eap/qe/ts/common/docker/ContainerStopException.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.jboss.eap.qe.ts.common.docker; | ||
|
||
/** | ||
* An exception thrown when container stop fails | ||
*/ | ||
public class ContainerStopException extends Exception { | ||
|
||
public ContainerStopException() { | ||
super(); | ||
} | ||
|
||
public ContainerStopException(String message) { | ||
super(message); | ||
} | ||
|
||
public ContainerStopException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public ContainerStopException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think
remove()
should be called from stop() and kill() medhod...as this might be source of failures.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.
The issue I see here is that the method called
stop
removes a container. That is IMHO not desired. What I have been thinking about is implementingClosable/AutoClosable
interface to have aclose
method. Which would care about cleanup when the container is no longer needed. WDYT?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.
I've found that there can be used
--rm
option indocker run...
which causes that container is automatically removed when stopped (or killed) what about to use it and get rid ofremove();