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 whitelist mod #1235

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

Overhaul core Tracker: add tests for whitelist mod #1235

josecelano opened this issue Feb 4, 2025 · 0 comments · Fixed by #1237
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 4, 2025

Parent issue: #1226

Coverage before:

Filename                                                                    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
packages/tracker-core/src/whitelist/authorization.rs                             18                 0   100.00%           8                 0   100.00%          46                 0   100.00%           0                 0         -
packages/tracker-core/src/whitelist/manager.rs                                   49                 7    85.71%          21                 3    85.71%         113                 7    93.81%           0                 0         -
packages/tracker-core/src/whitelist/mod.rs                                       13                 0   100.00%           4                 0   100.00%          33                 0   100.00%           0                 0         -
packages/tracker-core/src/whitelist/repository/in_memory.rs                      28                 0   100.00%          16                 0   100.00%          85                 0   100.00%           0                 0         -
packages/tracker-core/src/whitelist/repository/persisted.rs                      22                 6    72.73%           4                 0   100.00%          24                 2    91.67%           0                 0         -
packages/tracker-core/src/whitelist/setup.rs                                      1                 0   100.00%           1                 0   100.00%           7                 0   100.00%           0                 0         -
packages/tracker-core/src/whitelist/whitelist_tests.rs                            3                 0   100.00%           2                 0   100.00%          11                 0   100.00%           0                 0         -
@josecelano josecelano added - Developer - Torrust Improvement Experience Quality & Assurance Relates to QA, Testing, and CI Testing Checking Torrust labels Feb 4, 2025
@josecelano josecelano self-assigned this Feb 4, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 4, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 4, 2025
@josecelano josecelano linked a pull request Feb 4, 2025 that will close this issue
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 4, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 5, 2025
Now that we inject dependencies we can write assert using the dependencies instead of exposing public methods.
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 5, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 5, 2025
josecelano added a commit that referenced this issue Feb 5, 2025
e994aa2 refactor: [#1235] WhitelistManager tests (Jose Celano)
2862c77 refactor: [#1235] remove another pub methog only used for testing (Jose Celano)
f32f0bf refactor: [#1235] remove pun method only used for testing (Jose Celano)
1735dfc refactor: [#1235] remove unused methods (Jose Celano)
933b6b0 test: [#1235] add tests for WhitelistAuthorization (Jose Celano)
b4a4250 test: [#1235] add tests for DatabaseWhitelist (Jose Celano)

Pull request description:

  Overhaul core Tracker: add tests for `whitelist` mod

  Coverage before:

  ```output
  Filename                                                                    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  packages/tracker-core/src/whitelist/authorization.rs                             18                 0   100.00%           8                 0   100.00%          46                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/manager.rs                                   49                 7    85.71%          21                 3    85.71%         113                 7    93.81%           0                 0         -
  packages/tracker-core/src/whitelist/mod.rs                                       13                 0   100.00%           4                 0   100.00%          33                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/repository/in_memory.rs                      28                 0   100.00%          16                 0   100.00%          85                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/repository/persisted.rs                      22                 6    72.73%           4                 0   100.00%          24                 2    91.67%           0                 0         -
  packages/tracker-core/src/whitelist/setup.rs                                      1                 0   100.00%           1                 0   100.00%           7                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/whitelist_tests.rs                            3                 0   100.00%           2                 0   100.00%          11                 0   100.00%           0                 0         -
  ```

  Coverage after:

  ```output
  Filename                                                                    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  packages/tracker-core/src/whitelist/authorization.rs                             35                 1    97.14%          16                 0   100.00%         100                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/manager.rs                                   39                 3    92.31%          15                 0   100.00%         109                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/mod.rs                                       13                 0   100.00%           4                 0   100.00%          33                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/repository/in_memory.rs                      28                 0   100.00%          16                 0   100.00%          85                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/repository/persisted.rs                      33                 4    87.88%          10                 0   100.00%          79                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/setup.rs                                      1                 0   100.00%           1                 0   100.00%           7                 0   100.00%           0                 0         -
  packages/tracker-core/src/whitelist/whitelist_tests.rs                            3                 0   100.00%           2                 0   100.00%          11                 0   100.00%           0                 0         -
  ```

ACKs for top commit:
  josecelano:
    ACK e994aa2

Tree-SHA512: fea5a1b6fe0d25118563e70e71c8829c0efbacbbe69137c01dedb69dea457db4b4db3c5cc0ade902429d9c6a01d4f77b839d124ca953c32829efefeb8db936d1
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