grosser / parallel_tests

Ruby: 2 CPUs = 2x Testing Speed for RSpec, Test::Unit and Cucumber
3.37k stars 493 forks source link

Usage of $0 when using TeamCity Rake Runner #888

Open nbrien opened 1 year ago

nbrien commented 1 year ago

When using the rake runner build step in TeamCity we get an issue when parallel_drop[XXX] it calls the executing command via $0. which is the rakerunner. (this only broke after upgrading to Ruby 3.1)

https://github.com/grosser/parallel_tests/blob/fc090514799e8b46fa92752cc751b14fdac5f9a7/lib/parallel_tests/tasks.rb#L160

 /home/ubuntu/.rvm/gems/ruby-3.1.3@rails-6.0.6/gems/parallel_tests-3.13.0/lib/parallel_tests/test/runner.rb:111:in `popen': Permission denied - /opt/JetBrains/TeamCity/buildAgent/plugins/rake-runner/rb/runner/rakerunner.rb (Errno::EACCES)

The fix is to not use the rake runner and use a custom script in the build step, however I was curious if $0 should be used at all.

grosser commented 1 year ago

$0 seems to have worked for everyone so far, so I'm hesitant to change it. Afaik simplest solution would be to add some kind of PARALLEL_RAKE_RUNNER= env var. Alternative could be to find something similar to $0 but idk if that exists.

nbrien commented 1 year ago

Yes I was also thinking of an ENV switch. I can try prototype something over the holidays and open a pull. I understand the reluctance to change from the $0. I was however curious if parallel would work with anything else than rake?

Thanks for getting back to me and thanks for all the hard work over the years on your repos.

grosser commented 1 year ago

not sure if that's what you meant, but parallel ships with an executable, the rake task is just a wrapper around that

iovis commented 1 year ago

It breaks for us too, we just updated and we’re using an internal script to set up the context of projects and to reset state