Open estahn opened 7 years ago
@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.
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 %'
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.
I tried experimenting with describe
... context
but this didn't seem to work. It would be great to avoid introducing a new thing.
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.
Dockerspec Version
0.4.1
Ruby Version
2.4
Platform Details
Mac
Scenario
Run
docker_compose
from the same file in 2 different specs.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.