Skip to content

Allow DockerCube to create() a container when DESTROYED #988

@haster

Description

@haster
Issue Overview

Due to our testsetup (arquillian, junit, multi-threaded surefire) we create one (subclass of) DockerCube, representing our testcontainer, which handles a number of testclasses by repeatedly creating, starting, stopping, destroying that testcontainer. However, since #957 / #958 calling create on a destroyed DockerCube does nothing due to the state check on
https://github.com/arquillian/arquillian-cube/pull/958/files#diff-68554bf6fbadc1793c97b89f358bc69fR101

I can't think of a good reason why a destroyed container can't be recreated. Is it possible to modify the state-check so it also accepts DESTROYED when calling create() ?

If I overwrite the state value in our DockerCube subclass to set it to BEFORE_CREATE if it is DESTROYED our tests run as expected.

In essence, something like this happens:
DockerCube cube = new DockerCube();

cube.create(); // testclass 1
cube.start();
...
cube.stop();
cube.destroy();

cube.create(); // testclass 2
cube.start();
...

Expected Behaviour

Calling create() on a DESTROYED DockerCube recreates the container so that we can start() it once again.

Current Behaviour

Calling create() on a DESTROYED DockerCube does nothing, causing the subsequent start() to result in a "container not found".

Steps To Reproduce

I have no easily reproducible steps because the setup is complicated, meaning it would take time, and I think the problem is easily describable.

Additional Information

As this is more of an enhancement request I don't think any additional information is necessary, but if you would like more information please ask me 😃

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions