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

Overhaul core Tracker: add tests for databases mod #1251

Closed
Tracked by #1226
josecelano opened this issue Feb 7, 2025 · 0 comments · Fixed by #1255
Closed
Tracked by #1226

Overhaul core Tracker: add tests for databases mod #1251

josecelano opened this issue Feb 7, 2025 · 0 comments · Fixed by #1255
Assignees
Labels
- Developer - Torrust Improvement Experience Quality & Assurance Relates to QA, Testing, and CI Testing Checking Torrust

Comments

@josecelano
Copy link
Member

josecelano commented Feb 7, 2025

Parent issue: #1226

Overhaul core Tracker: add tests for databases mod.

@josecelano josecelano added - Developer - Torrust Improvement Experience Quality & Assurance Relates to QA, Testing, and CI Testing Checking Torrust labels Feb 7, 2025
@josecelano josecelano self-assigned this Feb 7, 2025
josecelano added a commit that referenced this issue Feb 7, 2025
…er core `databases` module.

3f78459 refactor: remove constructor from Database trait (Jose Celano)
c88ab10 refactor: reorganize tracker core databases mod (Jose Celano)

Pull request description:

  Some minor changes before [adding unit tests to the tracker core `databases` module](#1251).

  - [x] Reorganize the module.
  - [x] Remove the the `new` method from the `Database` trait.

  I have removed the `new` method from the `Database` trait because:

  - Drivers' dependencies might be different in the future for different drivers.
  - You can have conflicts when mocking the trait. See asomers/mockall@7c54ed1
  - The constructor is not part of the trait behavior in this case.

ACKs for top commit:
  josecelano:
    ACK 3f78459

Tree-SHA512: 412d3ed1d961a4bbe7dd22662cb4a264ade40aeb3771323a442c14b95eb9820dd4b9956976a14e92c678d00a04a27691c2a22c0e084255fb904f6b426d938cd2
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 7, 2025
@josecelano josecelano linked a pull request Feb 7, 2025 that will close this issue
17 tasks
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 7, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 7, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 10, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 10, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 10, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 10, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 10, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 10, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 11, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 11, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 11, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 11, 2025
josecelano added a commit that referenced this issue Feb 11, 2025
2cd1c65 test: [#1251] add tests for database driver error converters (Jose Celano)
adb9614 tests: [#1251] add test for loading keys in DB drivers (Jose Celano)
700482d test: [#1251] reset database before running db driver tests (Jose Celano)
b9188c7 test: [#1251] add tests for whitelist is DB drivers (Jose Celano)
613efb2 fix: [#1257] bug 3. Expiring auth keys ignore fractions of seconds (Jose Celano)
b94179d fix: [#1257] bug 2. Auth keys can't be removed in MySQL (Jose Celano)
595397b fix: [#1257] bug 1. permanent keys can't be created in MySQL (Jose Celano)
7ddacdc test: [#1251] unify test runner for sqlite and mysql drivers (Jose Celano)
46949a6 test: [#1251] add tests for core database driver mysql (Jose Celano)
568d6d3 test: [#1251] add tests for core database driver sqlite (Jose Celano)

Pull request description:

  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):

  - [x] load_persistent_torrents
  - [x] save_persistent_torrent

  Authentication keys (for private trackers):

  - [x] load_keys
  - [x] get_key_from_keys
  - [x] add_key_to_keys
  - [x] remove_key_from_keys

  Whitelist (for listed trackers):

  - [x] load_whitelist
  - [x] get_info_hash_from_whitelist
  - [x] add_info_hash_to_whitelist
  - [x] remove_info_hash_from_whitelist

  ### Sub-tasks

  - [x] `driver`
    - [x] `mod.rs` (no direct tests added)
    - [x] `mysql.rs`
    - [x] `sqlite.rs`
  - [x] `error.rs`
  - [x] `mod.rs` (no direct tests added)
  - [x] `setup.rs` (no direct tests added)

ACKs for top commit:
  josecelano:
    ACK 2cd1c65

Tree-SHA512: 07e92b5458053ae27b424bbd0d9bd35cf44b0a8a1ac2c16eb4c64016295b6770a5b426a132002d091c0fab7e754d198f2906498f733119f386831bdcac50aa1e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Developer - Torrust Improvement Experience Quality & Assurance Relates to QA, Testing, and CI Testing Checking Torrust
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant