serpapi / turbo_tests

Run RSpec tests on multiple cores. Like parallel_tests but with incremental summarized output. Originally extracted from the Discourse and Rubygems source code.
https://rubygems.org/gems/turbo_tests
MIT License
173 stars 25 forks source link

TEST_ENV_NUMBER value incorrect for first process #12

Open scottbartell opened 3 years ago

scottbartell commented 3 years ago

The TEST_ENV_NUMBER env var is being set to 1 for the first process when parallel_tests expects it to be blank. This is causing issues because parallel_tests doesn't create a database whereTEST_ENV_NUMBER=1 when you run rake parallel:setup.

Here's where TEST_ENV_NUMBER is being set to 1: https://github.com/serpapi/turbo_tests/blob/master/lib/turbo_tests/runner.rb#L112

Here's the docs for parallel_tests: https://github.com/grosser/parallel_tests#add-to-configdatabaseyml


I'd be happy to address this but I'm curious if we think turbo_tests should be changed to set the value to empty string like parallel_tests expects or if we should figure out if we can configure parallel_tests to use the value 1 for the first process and just add some documentation on how to do that?

ilyazub commented 3 years ago

Hi @scottbartell, parallel_tests can set TEST_ENV_NUMBER to 1 for the first process by adding the --first-is-1 CLI option.

Ref: lib/parallel_tests/cli.rb:252.

parallel_tests --first-is-1

The random blog post that describes a similar problem.

Let me know if it solves the problem you've encountered.


_PS. Can you tell me about your usage workflow of parallel_tests and turbo_tests?_

louim commented 3 years ago

The solution if you want to use parallel_tests to do database creation (what I assume you done because I hit the same problem). PARALLEL_TEST_FIRST_IS_1=true rake parallel:setup or the first database will be named my_database_test instead of my_database_test1 like this gem expect. I think it should be mentioned in the readme. I can do a PR if you like.

ilyazub commented 3 years ago

@louim Yes, please update the documentation in PR.

Mayurifag commented 2 years ago

@louim have you already made request? It seems, repo is missing information about TEST_ENV_NUMBER at all.

louim commented 2 years ago

@Mayurifag sorry, I totally forgot to do a PR. I'll try to draft one this week, but if you want to create one, go ahead!

gutoarraes commented 2 months ago

if I understand correctly, all we're missing here is an update to the README to mention the --first-is-1 flag needed to name the first instance of TEST_ENV_NUMBER. Let me know if that's the case and I can write a quick PR for this.