Parallel_test gem `ENV['TEST_ENV_NUMBER']` nil


#1

I have an enterprise installation on AWS instances, and everything has been working fine till the afternoon of June 15th when everything started going solid red.

We run 6 nodes per build with each node running 2 processes via the parallel_test gem.

Our in our circle.yml:

test:
  override:
    - ruby ./split.rb:
        parallel: true

Here is the ruby command we use within split.rb
exit_code_1 = system("TEST_ITERATION=1 DISABLE_SPRING=true RAILS_ENV=test bundle exec parallel_rspec -n 2 --runtime-log ./runtime_rspec.opts #{$files}")

While troubleshooting I modified this to:
exit_code_1 = system("TEST_ITERATION=1 DISABLE_SPRING=true RAILS_ENV=test bundle exec parallel_rspec -n 2 --runtime-log ./runtime_rspec.opts #{$files} -e 'ruby -e \"puts %[hello from process #{ENV[:TEST_ENV_NUMBER.to_s].inspect}]\"'")

This runs fine locally:

hello from process ""
hello from process "2"

However, on CI:

hello from process nil
hello from process nil

Any ideas?

Thanks,
Sean


#2

Changing how ruby is executed within the system call, shows the env vars are set correctly.

Tempfile.create do |fp|
  fp.write(<<-RUBY)
puts "hello from process \#{ENV['TEST_ENV_NUMBER'].inspect}"
  RUBY

  fp.flush
  system("TEST_ITERATION=1 DISABLE_SPRING=true RAILS_ENV=test bundle exec parallel_rspec -n 2 --runtime-log ./runtime_rspec.opts #{$files} -e 'ruby #{fp.path}'")
end

#3