Rake Runner w/ RSPec Reporter in Docker Container

 

Hi, 

My use case:

  1. I want to run RSpec tests on TeamCity and have a reporter that can parse the output
  2. I use `docker-compose` to orchestrate several containers (postgres, other services) that are required for the tests.  Rails server is run within the container.  I use `docker exec` to call kick off the tests, using a shell script in the container.

Is there any way to use Rake runner to run commands in a container, not on the host system.  I use docker containers for segregation, not rvm or other tool for segregation, and it also has environment consistency between test + production.  Also, if I ran the tests on the system, I would have to do a lot of complex setup to edit `config/database.yml` for a `RAILS_ENV=test`.  The containerized environment has all of this baked and ready to go.

Problem: It seems (1) Rspec reporter is only available with available for Rake runner, (2) Rake runner only seems to be able to run on the system, cannot exec bash into the container.

We are currently running TC 9.0.3 (build 32334), but we can upgrade to latest in the future.

 

0
1 comment

Hi And sorry for the delay.

We have recently introduced support for docker (https://confluence.jetbrains.com/display/TCD10/Integrating+TeamCity+with+Docker), and while most of it should work, I cannot currently confirm it would work for your use case. Please feel free to make a test installation and see whether it actually works for you.

While the Rspec reporter is only available in the rake runner, there are ways to convert the rspec reports into JUnit format, which can be later parsed by our XML Report Processing build feature to include the results. Some examples:
https://github.com/sj26/rspec_junit_formatter
https://github.com/ci-reporter/ci_reporter

This is probably the easiest way to achieve what you want.

0

Please sign in to leave a comment.