Open tnine opened 9 years ago
Hi, well first thing to note is that shouldAllowToConnectToRunningContainers
has a bug which makes to not work pretty well. So I will suggest you to not use it until we fix it :). Also let me explain that using shouldAllowToConnectToRunningContainers
means that you have started the container by yourself not by arquillian cube. I mean that what we expect is that you have started manually the container and if not (although it has been started by cube) the parameter will be ignored. This is because in starting phase we can get if the name of the container is already running or not and act accordantly, but in time of stopping it we don't know if one container should be closed or not. To avoid confusion (or at least this is what we tried) was that this attribute only works if you manually start the container.
About your question: Well the problem is that in cube we always destroy the containers after the execution because it can be started again in next test. If for example your test doesn't finish because you halt it manually then the container is not destroyed so it cannot be created after that. So what you need to do is remove it manually. Also until we fix the issue with autostart I recommend you to
I left the issue opened to improve this situation by destroying container before start in case it is already started.
@lordofthejars destroying the container before start sounds a bit scary. A little miss config and stuff gets lost.
@aslakknutsen I totally agree with you, maybe it is better to leave as is, but maybe we could capture the exception and if the exception is that the container is already started we could or simply avoid the creation and start or we can destroy and recreate. As I said the best way would be leave as is, but we can think other alternatives as well.
@aslakknutsen and @lordofthejars I would think as a laymen user this would be an idempotent operation. I would envision the following semantics to make it a bit more user friendly and declartive.
1) Does the container exist? If so, simply use it. 2) If not pull it and start it. 3) If it already exists and is running, what then? Maybe just throw an exception? This can get tricky, it seems like every user might have a different strategy for handling this. Perhaps a configuration or interface with some commands users can invoke to handle this for their specific cases?
Then for cleaning
Is it possible to allow users to invoke a clean command to remove existing images? IMHO this is kind of an edge case. I think it's safer and easier to simply document this and allow users to remove their own images. Since there's a strong toolset around this, and it's a 1 off sort of scenario, I can't envision it's something that users would need to run on every build.
Thoughts?
So we can do two things, document this and add in documentation the command that must be run to destroy the container, or we can create an attribute which tells if should connect to existing running container, throw an exception or remove it. Basically is changing shouldAllowToConnectToRunningContainers to a new name and new type instead of a boolean.
WDYT?
This is slightly different tho. It's not allow to connect to, but allow to use existing container with name..
If the container is running is a different concern.
On Thu, Jan 29, 2015, 16:59 Alex Soto notifications@github.com wrote:
So we can do two things, document this and add in documentation the command that must be run to destroy the container, or we can create an attribute which tells if should connect to existing running container, throw an exception or remove it. Basically is changing shouldAllowToConnectToRunningContainers to a new name and new type instead of a boolean.
WDYT?
— Reply to this email directly or view it on GitHub https://github.com/arquillian/arquillian-cube/issues/79#issuecomment-72049296 .
I'm a bit new on this.. But existing container could have a different state then when created? Or would we need a commit step here for that to happen?
Basically we need to track, has our configuration for creating this container changed? If not, then on to reuse. If it has, then.....
Hey guys, I'm working on a fix for this now. It's actually a trivial fix and test. However, there's no test for the DockerClientExecutor class. I would like to get this set up a few tests with a small "hello world" type of docker image. Is there an image you guys would prefer I use for this test?
We don't have any predefined image, if you want you can use the docker-server-stub to create a test if you want to use a stub instead of a true docker server, but feel free.
https://github.com/arquillian/arquillian-cube/tree/master/docker-server-stub
On one hand we have the reconnect feature to allow reusing a running container to save startup time during development, but could also be used to connect to existing containers that are running/started by 3. party for what ever reason.
On the other we have crashed images.. Being able to clean up a existing container would be a nice feature, tho I don't think it should be default.
Take the build server scenario for instance. Jenkins is running, the build crash for what ever reason and you're now left with x number of 'stuck' containers. The build will continue to fail until someone manually goes and cleans up the docker server used by the job.
In this scenario I think both reconnect and reuse are wrong:
After talking with @aslakknutsen we are going to close this issue because it is the same as https://github.com/arquillian/arquillian-cube/issues/67 in the sense that talks about reusing an existing running container. We are going to continue the discussing there.
@tnine Has it sense to you to talk on that issue about the problem of reusing containers?
I have the following arquillian.xml file.
When I run my trivial test below, it runs the first time
Subsequent invocation results in the following error.
I'm not sure where to start to resolve this issue. I'm on version 1.0.0.Alpha3, Arquillian version 1.1.6.Final