Repository navigation
test: keep every table after the usage test fixture - #1067
Merged
Merged
Conversation
With TEST_FROM set, the session_factory fixture of tests/test_record_usages.py works on the shared CI database and dropped every table at teardown. The cleanup and reset tests reuse that fixture, so any later file in the same run that uses the app database failed with "no such table". Since #1066 changed the shard split, test_cleanup_subscription_updates.py runs before tests/test_node_core_users_tags.py in one shard, and the tags test fails on all five databases: dev in shard 0, #1053 (which moves the pair) in shard 1. Teardown now recreates the tables empty after dropping them.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Free-Guy-IR
pushed a commit
to Free-Guy-IR/panel
that referenced
this pull request
Nov 3, 2026
With TEST_FROM set, the session_factory fixture of tests/test_record_usages.py works on the shared CI database and dropped every table at teardown. The cleanup and reset tests reuse that fixture, so any later file in the same run that uses the app database failed with "no such table". Since PasarGuard#1066 changed the shard split, test_cleanup_subscription_updates.py runs before tests/test_node_core_users_tags.py in one shard, and the tags test fails on all five databases: dev in shard 0, PasarGuard#1053 (which moves the pair) in shard 1. Teardown now recreates the tables empty after dropping them. Fork adaptation: no change. The fork's session_factory teardown in tests/test_record_usages.py already recreates every table after drop_all (34c5613) and also restores the rows it snapshotted from a shared database, so the upstream hunk is superseded. (cherry picked from commit 716576e)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test-only fix. With
TEST_FROMset (every CI database job), thesession_factoryfixture oftests/test_record_usages.pyworks on theshared CI database and dropped every table at teardown.
tests/test_cleanup_subscription_updates.pyandtests/test_reset_user_data_usage.pyreuse that fixture, so any later file in the same run that uses the app database failed with "no such table".
Since CI is sharded by file, which files share a run depends on file sizes. Since #1066,
test_cleanup_subscription_updates.pyruns beforetest_node_core_users_tags.py(added in #1055) in one shard, and the tags test fails on all five databases (no such table: groups,relation "groups" does not exist,Table 'testdb.groups' doesn't exist): dev659d4cf0in shard 0, #1053 in shard 1.Teardown now recreates the tables empty after dropping them, so later files find every table.
Tests
test_cleanup_subscription_updates.pythentest_node_core_users_tags.py,TEST_FROM=githubon a freshly migrated database:before the fix 1 failed / 2 passed on SQLite, PostgreSQL and MySQL 8.4; after it 3 passed on all three.
TEST_FROM=github, freshly migrated): PostgreSQL 666 + 688 passed, MySQL 8.4665 + 688 passed, SQLite 665 + 687 passed, 0 failed. (PostgreSQL shard 0 needs
TZ=UTC, as on CI: with a non-UTC local zonetests/api/test_usage_functions_timezone.pyfails on dev too.)