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

docker_compose doesn't shutdown container after describe end #8

Open
estahn opened this issue Apr 4, 2017 · 5 comments
Open

docker_compose doesn't shutdown container after describe end #8

estahn opened this issue Apr 4, 2017 · 5 comments

Comments

@estahn
Copy link

estahn commented Apr 4, 2017

Dockerspec Version

0.4.1

Ruby Version

2.4

Platform Details

Mac

Scenario

Run docker_compose from the same file in 2 different specs.

test1_spec -> docker_compose(default.yml)
test2_spec -> docker_compose(default.yml)

Steps to Reproduce

Expected Result

After describe docker_compose() do ... end the containers should shutdown.

Actual Result

Containers stay active until rspec is finished.

Possible Solution

In order to maintain backwards compatibility it might be worth to introduce a new flag shutdown for the docker_compose method.

@zuazo
Copy link
Owner

zuazo commented Apr 4, 2017

@estahn unfortunately, I do not think this can be fixed due to the way rspec and serverspec work.

Right now all the containers are started, then the tests are passed, and then they all stop in a third stage. I tried to change this some time ago, but it seemed impossible.

In addition to that, and even if it were possible, this would imply that you could not execute things like os[:family] out of it / before blocks. And sometimes that's the case, as commented in #2.

@estahn
Copy link
Author

estahn commented Apr 4, 2017

It appears rspec doesn't have an isolation feature similar to phpunit. I'm running it now manually in "isolation" :)

find spec -name "*_spec.rb" | xargs -I% -n1 /bin/bash -c 'MY_VAR=123 bundle exec rspec %'

@zuazo
Copy link
Owner

zuazo commented Apr 4, 2017

Yes, that's a good solution.

Maybe it could be possible to implement some kind of special resource, something like a docker_context do ... end to isolate the different executions of rspec&docker. I wrote it down in the TODO list. I researched how to do it some time ago, but I could not figure out how. I'm not saying it's impossible, but it does not seem like a simple task.

@estahn
Copy link
Author

estahn commented Apr 4, 2017

I tried experimenting with describe ... context but this didn't seem to work. It would be great to avoid introducing a new thing.

@zuazo
Copy link
Owner

zuazo commented Apr 4, 2017

With the original describe is not possible to do that. However, it does not seem possible to do it the other way either without changing the internal behavior of RSpec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants