Skip to content

Don't use the db_schema fixture in guardian_db #3448

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

Merged
merged 1 commit into from
Jul 4, 2025

Conversation

Eijebong
Copy link
Contributor

@Eijebong Eijebong commented Jul 4, 2025

The db_schema fixture is session scopes while the guardian_db one is module scoped. If the guardian_db fixture is used in tests that get run out of order, the module fixture gets called again and explodes because it's inserting into the session database again.

For example if tests are ran like this:

  • test_json:A
  • another_module:Foo
  • test_json:B

It would result in:

  • db_schema
  • guardian_db
  • test_json:A
  • another_module:Foo
  • guardian_db # BOOM
  • test_json:B

This should hopefully fix the intermittent we've been seeing in test_json

The db_schema fixture is session scopes while the guardian_db one is
module scoped. If the guardian_db fixture is used in tests that get
run out of order, the module fixture gets called again and explodes
because it's inserting into the session database again.

For example if tests are ran like this:

- test_json:A
- another_module:Foo
- test_json:B

It would result in:

- db_schema
- guardian_db
- test_json:A
- another_module:Foo
- guardian_db # BOOM
- test_json:B

This should hopefully fix the intermittent we've been seeing in test_json
@Eijebong Eijebong requested a review from a team as a code owner July 4, 2025 12:33
@Eijebong Eijebong merged commit 88de160 into mozilla-releng:main Jul 4, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants