Stopping Test Servers on Gitlab CI?
I posted this on SO, but figured it might be more appropriate here since it's an actual testing question.
I have a CI.yaml file (For Gitlab CI) that builds our Rails app and runs integration (Rspec/Capybara tests)
before_script: - rbenv install --skip-existing `cat .ruby-version` - bundle install - RAILS_ENV=test bundle exec rake db:drop db:create db:migrate db:seed rspec: script: - bundle exec rspec . --tag type:feature tags: - ruby
Pretty simple right? However i'll need to spin up a Rails app server to actually run these on via
bundle exec rails s
Does anyone know the best way to stop such a server on a CI stack? (Were using Gitlab). Im pretty sure Gitlab doesn't stop any servers running after the build, so i'd need to kill it some way but im not sure of the best way.
jeanid last edited by
For reference (In case someone comes across this), this was solved by allowed Capybara itself to spin up the server, since it will automatically stop itself once the tests are finished.
This was done by adjusting the app_host and server_host/etc... for capybara in my test_helper.rb file:
Capybara.app_host = "http://localhost:3000" Capybara.server_host = "localhost" Capybara.server_port = "3000"