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

Make turbo_test.rb consistent with Rails' generated test_helper.rb #328

Closed
wants to merge 1 commit into from

Conversation

seanpdoyle
Copy link
Contributor

@seanpdoyle seanpdoyle commented May 3, 2022

I've opened this as a draft PR, since I'm unsure about the root-cause of database records leaking across test runs

Something in the test suite configuration is preventing the database
from being wiped between test runs. This results in state leaking
between tests. As a result, our Continuous Integration tests are flaky.

-- hotwired/turbo-rails#248

As a follow-up to the short-term solution shipped in
hotwired/turbo-rails#248, this commit attempts to make the
test/turbo_test.rb file's setup consistent with the test harness setup
generated by Rails' engine generator code.

To that end, this commit:

  • renames the test/turbo_test.rb file to test/test_helper.rb
  • omits one-off require calls for particular dependencies
  • re-orders the require calls so that the
    ../test/dummy/config/environment file is required ahead of the
    rails/test_help file

@seanpdoyle seanpdoyle changed the title Make turbo_test.rb with Rails' generated test_helper.rb Make turbo_test.rb consistent with Rails' generated test_helper.rb May 3, 2022
@seanpdoyle
Copy link
Contributor Author

Unfortunately, this didn't resolve the CI failures.

My hunch is that there's a missing or misconfigured Active Record value somewhere that's resulting in records persisting across test runs.

> Something in the test suite configuration is preventing the database
> from being wiped between test runs. This results in state leaking
> between tests. As a result, our Continuous Integration tests are flaky.
>
> - [hotwired#248][]

As a follow-up to the [short-term solution][] shipped in
[hotwired#248][], this commit attempts to make the
`test/turbo_test.rb` file's setup consistent with the test harness setup
generated by Rails' [engine generator][] code.

To that end, this commit:

* renames the `test/turbo_test.rb` file to `test/test_helper.rb`
* omits one-off `require` calls for particular dependencies
* re-orders the require calls so that the
  `../test/dummy/config/environment` file is required ahead of the
  `rails/test_help` file

[engine generator]: https://github.com/rails/rails/blob/3c48b4030adbded21bebaa0d78254216cca48a6e/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt
[hotwired#248]: hotwired#248
[short-term solution]: hotwired@c2dc5b1
@seanpdoyle seanpdoyle marked this pull request as ready for review August 1, 2022 20:07
@seanpdoyle
Copy link
Contributor Author

Closing in favor of unifying streams of work into #327.

@seanpdoyle seanpdoyle closed this Aug 1, 2022
@seanpdoyle seanpdoyle deleted the test-helper branch August 1, 2022 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant