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

Use DatabaseCleaner gem to remove bad test state #5214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martinemde
Copy link
Member

Should fix the regular problem where test state can be left in the database, which causes errors like the following:

ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_api_keys_on_hashed_key"

Copy link

codecov bot commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.75%. Comparing base (779ee17) to head (a468f37).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5214   +/-   ##
=======================================
  Coverage   96.75%   96.75%           
=======================================
  Files         430      430           
  Lines        9120     9120           
=======================================
  Hits         8824     8824           
  Misses        296      296           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@simi
Copy link
Member

simi commented Nov 10, 2024

Any idea which test left this?

@martinemde
Copy link
Member Author

@simi no, it seems to happen pretty reliably if you interrupt the tests, but running all integration tests on the organizations branch seemed to trigger it.

This isn't just a rare thing for me though, it happens all the time. The ApiKey one has been happening for a while. Even just clearing the database at the start rather than after each test would make a big difference.

@@ -99,6 +102,7 @@ class ActiveSupport::TestCase

teardown do
Rails.configuration.launch_darkly_client.close
DatabaseCleaner.clean
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove this and just clear at the start of each run. This would solve the main problem I see.

@simi
Copy link
Member

simi commented Nov 10, 2024

@simi no, it seems to happen pretty reliably if you interrupt the tests, but running all integration tests on the organizations branch seemed to trigger it.

This isn't just a rare thing for me though, it happens all the time. The ApiKey one has been happening for a while. Even just clearing the database at the start rather than after each test would make a big difference.

Do you think it is related to system tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants