Skip to content

test: keep every table after the usage test fixture - #1067

Merged
T3ST3ST3R0N merged 1 commit into
devfrom
fix/usage-fixture-keeps-tables
Oct 22, 2026
Merged

T3ST3ST3R0N merged 1 commit into
devfrom
fix/usage-fixture-keeps-tables

Conversation

@T3ST3ST3R0N

Copy link
Copy Markdown
Collaborator

Summary

Test-only fix. With TEST_FROM set (every CI database job), the session_factory fixture of tests/test_record_usages.py works on the
shared CI database and dropped every table at teardown. tests/test_cleanup_subscription_updates.py and tests/test_reset_user_data_usage.py
reuse 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.py runs before
test_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): dev 659d4cf0 in 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.py then test_node_core_users_tags.py, TEST_FROM=github on 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.
  • dev + this fix + fix(hosts): isolate broken hosts and stale xHTTP download hosts #1053, both CI shards, serial like CI (TEST_FROM=github, freshly migrated): PostgreSQL 666 + 688 passed, MySQL 8.4
    665 + 688 passed, SQLite 665 + 687 passed, 0 failed. (PostgreSQL shard 0 needs TZ=UTC, as on CI: with a non-UTC local zone
    tests/api/test_usage_functions_timezone.py fails on dev too.)

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.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 209e2735-b021-4f0c-ac37-bf42afa2e2f5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@T3ST3ST3R0N
T3ST3ST3R0N merged commit 716576e into dev Oct 22, 2026
28 checks passed
@T3ST3ST3R0N
T3ST3ST3R0N deleted the fix/usage-fixture-keeps-tables branch October 22, 2026 12:34
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)
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.

1 participant