Skip to content

Overhaul core Tracker: add tests for databases mod #1255

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Feb 7, 2025

Overhaul core Tracker: add tests for databases mod.

Regarding the database drivers these are the methods in the Database trait grouped by context:

Schema:

  • create_database_tables
  • drop_database_tables (this is only used for testing)

Persistent torrents (stats):

  • load_persistent_torrents
  • save_persistent_torrent

Authentication keys (for private trackers):

  • load_keys
  • get_key_from_keys
  • add_key_to_keys
  • remove_key_from_keys

Whitelist (for listed trackers):

  • load_whitelist
  • get_info_hash_from_whitelist
  • add_info_hash_to_whitelist
  • remove_info_hash_from_whitelist

Sub-tasks

  • driver
    • mod.rs (no direct tests added)
    • mysql.rs
    • sqlite.rs
  • error.rs
  • mod.rs (no direct tests added)
  • setup.rs (no direct tests added)

@josecelano josecelano self-assigned this Feb 7, 2025
@josecelano josecelano added Quality & Assurance Relates to QA, Testing, and CI - Developer - Torrust Improvement Experience Testing Checking Torrust labels Feb 7, 2025
@josecelano josecelano linked an issue Feb 7, 2025 that may be closed by this pull request
@josecelano josecelano requested a review from da2ce7 February 7, 2025 17:33
@josecelano josecelano force-pushed the 1251-overhaul-core-tracker-add-tests-for-databases-mod branch from 896bc05 to 78b11c8 Compare February 7, 2025 17:43
@josecelano josecelano force-pushed the 1251-overhaul-core-tracker-add-tests-for-databases-mod branch from 78b11c8 to 25eea20 Compare February 7, 2025 17:55
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 70.35714% with 83 lines in your changes missing coverage. Please review.

Project coverage is 81.04%. Comparing base (24ae70d) to head (2cd1c65).
Report is 11 commits behind head on develop.

Files with missing lines Patch % Lines
...ackages/tracker-core/src/databases/driver/mysql.rs 11.76% 60 Missing and 15 partials ⚠️
packages/tracker-core/src/databases/error.rs 80.95% 0 Missing and 4 partials ⚠️
packages/tracker-core/src/databases/driver/mod.rs 97.72% 3 Missing ⚠️
...es/tracker-core/src/authentication/key/peer_key.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1255      +/-   ##
===========================================
+ Coverage    80.96%   81.04%   +0.07%     
===========================================
  Files          206      206              
  Lines        14478    14748     +270     
  Branches     14478    14748     +270     
===========================================
+ Hits         11722    11952     +230     
- Misses        2581     2599      +18     
- Partials       175      197      +22     

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

@josecelano josecelano force-pushed the 1251-overhaul-core-tracker-add-tests-for-databases-mod branch from 25eea20 to 568d6d3 Compare February 10, 2025 11:22
@josecelano
Copy link
Member Author

I've found some bugs while writing tests. I will fix them in this PR because I'm almost done and It will be merge soon.

@josecelano josecelano force-pushed the 1251-overhaul-core-tracker-add-tests-for-databases-mod branch from d83c32d to f233ec3 Compare February 10, 2025 18:24
@josecelano josecelano force-pushed the 1251-overhaul-core-tracker-add-tests-for-databases-mod branch from f233ec3 to 46949a6 Compare February 10, 2025 18:25
…onds

The `Duration` of a peer Key can have gractions of seconds. However we
only store seconds (integer) in the database.

When comparing peer keys we should ignore the fractions.
@josecelano josecelano force-pushed the 1251-overhaul-core-tracker-add-tests-for-databases-mod branch from 4d83116 to b9188c7 Compare February 11, 2025 10:36
@josecelano
Copy link
Member Author

ACK 2cd1c65

@josecelano josecelano marked this pull request as ready for review February 11, 2025 11:35
@josecelano josecelano requested a review from a team as a code owner February 11, 2025 11:35
@josecelano josecelano merged commit ea2d73d into torrust:develop Feb 11, 2025
22 of 23 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
- Developer - Torrust Improvement Experience Quality & Assurance Relates to QA, Testing, and CI Testing Checking Torrust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overhaul core Tracker: add tests for databases mod
1 participant