turbo_tests
turbo_tests copied to clipboard
TEST_ENV_NUMBER value incorrect for first process
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?
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?
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.
@louim Yes, please update the documentation in PR.
@louim have you already made request? It seems, repo is missing information about TEST_ENV_NUMBER at all.
@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!
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.