Skip to content
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
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public void dropDatabaseSchema() {
public static void tearDown() throws Exception {
// stop DB if still running and delete data directory
postgresDB.stop();
postgresDB.remove();
Copy link
Member

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.

Copy link
Member Author

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 implementing Closable/AutoClosable interface to have a close method. Which would care about cleanup when the container is no longer needed. WDYT?

Copy link
Member

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 in docker run... which causes that container is automatically removed when stopped (or killed) what about to use it and get rid of remove();

postgresDataDir.delete();
MicroProfileFaultToleranceServerConfiguration.disableFaultTolerance();
}
Expand Down
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;

}
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);
}
}
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);
}

}
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);
}
}
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);
}
}
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);
}
}
Loading