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

Tracker Checker: check UDP trackers #664

Merged

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Jan 31, 2024

Add checks for UDP trackers to the Tracker Checker.

The output will look like the following:

Running checks for trackers ...
UDP trackers ...
✓ - Announce at 127.0.0.1:6969 is OK
✓ - Scrape at 127.0.0.1:6969 is OK
HTTP trackers ...
✓ - Announce at http://127.0.0.1:7070/ is OK
✓ - Scrape at http://127.0.0.1:7070/ is OK
Health checks ...
✓ - Health API at http://127.0.0.1:1313/health_check is OK

See subtasks in #639

@josecelano josecelano self-assigned this Jan 31, 2024
@josecelano josecelano added Enhancement / Feature Request Something New - Developer - Torrust Improvement Experience Testing Checking Torrust labels Jan 31, 2024
@josecelano josecelano linked an issue Jan 31, 2024 that may be closed by this pull request
2 tasks
@josecelano josecelano added this to the v3.0.0 milestone Jan 31, 2024
Copy link

codecov bot commented Jan 31, 2024

Codecov Report

Attention: 118 lines in your changes are missing coverage. Please review.

Comparison is base (c291ef1) 73.71% compared to head (873f98d) 73.05%.

Files Patch % Lines
src/console/clients/udp/responses.rs 0.00% 34 Missing ⚠️
src/console/clients/udp/app.rs 0.00% 24 Missing ⚠️
src/console/clients/udp/checker.rs 0.00% 20 Missing ⚠️
src/console/clients/checker/app.rs 0.00% 16 Missing ⚠️
src/shared/bit_torrent/tracker/udp/client.rs 62.06% 11 Missing ⚠️
src/console/clients/checker/checks/http.rs 0.00% 6 Missing ⚠️
src/console/clients/checker/checks/health.rs 0.00% 4 Missing ⚠️
src/console/clients/checker/checks/udp.rs 0.00% 2 Missing ⚠️
src/console/clients/checker/service.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #664      +/-   ##
===========================================
- Coverage    73.71%   73.05%   -0.66%     
===========================================
  Files          138      143       +5     
  Lines         9065     9164      +99     
===========================================
+ Hits          6682     6695      +13     
- Misses        2383     2469      +86     

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

The output for the UDP tracker checks are now the same as the HTTP
tracker checks. But not implemented yet (TODO).

```output
Running checks for trackers ...
UDP trackers ...
✓ - Announce at 127.0.0.1:6969 is OK
✓ - Scrape at 127.0.0.1:6969 is OK
HTTP trackers ...
✓ - Announce at http://127.0.0.1:7070/ is OK (TODO)
✓ - Scrape at http://127.0.0.1:7070/ is OK (TODO)
Health checks ...
✓ - Health API at http://127.0.0.1:1313/health_check is OK
```
…eck UDP servers

It will be used in teh Tracker Checker too.
It allows simplifying the wasy we build InfoHashes from hex strings:

```rust
let info_hash = InfoHash(hex!("9c38422213e30bff212b30c360d26f9a02136422")); // # DevSkim: ignore DS173237
```
This is the first working implementation. WIP.

TODO:

- Refactor: reorganize code: big functions, etc.
- Bugs: if the UDP server is down the checker waits forever. Probably
  there is a missing timeout for the connection request. And in general
for all requests.
The generic UDP client does not have timeouts. When the server is down
it waits forever for responses. This client has been using only for
testing where the server was always up, but now it's using in production
code by the Tracker Checker.

For the time being, I keep the panicking behavior of the UdpClient when
something is wrong. However we should return an error when the operation
times out.

For the Tracker Checker, it means that when the checker can't connect to
a UDP server the checker is going to panic after 5 seconds. That is not
the intended behavior for the checker. It should always return a full
reprot of all checks. In order to implement that behavior we need to
change the UdpClient to return errors. Since that's a bug refactor I
open a new issue.
@josecelano josecelano marked this pull request as ready for review February 1, 2024 17:23
@josecelano
Copy link
Member Author

ACK 873f98d

@josecelano
Copy link
Member Author

Hi @da2ce7 there is still a lot to improve but I want to merge this PR asap because this version runs all the checks: HTTP tracker, UDP Tracker and Health Checks. This PR adds the UDP checks.

We are running the checker in the E2E tests and this ensures that the UDP service is working correctly.

I will open a new epic issue with all the improvements/changes we can make in the short and long term.

@josecelano josecelano merged commit 2bc2bff into torrust:develop Feb 1, 2024
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Developer - Torrust Improvement Experience Enhancement / Feature Request Something New Testing Checking Torrust
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Tracker Checker: check UDP trackers
1 participant