Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST_ENV_NUMBER value incorrect for first process #12

Open
scottbartell opened this issue Mar 26, 2021 · 6 comments
Open

TEST_ENV_NUMBER value incorrect for first process #12

scottbartell opened this issue Mar 26, 2021 · 6 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@scottbartell
Copy link

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
Copy link
Collaborator

ilyazub commented Apr 2, 2021

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?

@ilyazub ilyazub added the question Further information is requested label Apr 2, 2021
@louim
Copy link

louim commented Aug 6, 2021

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 ilyazub added documentation Improvements or additions to documentation help wanted Extra attention is needed and removed question Further information is requested labels Aug 13, 2021
@ilyazub
Copy link
Collaborator

ilyazub commented Aug 13, 2021

@louim Yes, please update the documentation in PR.

@Mayurifag
Copy link

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

@louim
Copy link

louim commented Jan 27, 2022

@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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants