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: console command to run tracker checks #637

Closed
4 tasks done
Tracked by #620
josecelano opened this issue Jan 22, 2024 · 4 comments
Closed
4 tasks done
Tracked by #620

Tracker Checker: console command to run tracker checks #637

josecelano opened this issue Jan 22, 2024 · 4 comments
Assignees
Labels
EPIC Contains several subissues Testing Checking Torrust
Milestone

Comments

@josecelano
Copy link
Member

josecelano commented Jan 22, 2024

Parent issue: #620

Console command that runs some checks against live running trackers. It would be used for:

  • E2E testing.
  • Smoke tests after deploying the live demo.

It can be run with the following alternatives:

cargo run --bin tracker_checker -- --config-path "./share/default/config/tracker_checker.json"

TORRUST_CHECKER_CONFIG_PATH="./share/default/config/tracker_checker.json" cargo run --bin tracker_checker

TORRUST_CHECKER_CONFIG=$(cat "./share/default/config/tracker_checker.json") cargo run --bin tracker_checker

And you can pass a list of services to check in the configuration:

{
    "udp_trackers": [
        "127.0.0.1:6969"
    ],
    "http_trackers": [
        "http://127.0.0.1:7070"
    ],
    "health_checks": [
        "http://127.0.0.1:1313/health_check"
    ]
}

For UDP and HTTP trackers it will make an announce and scrape requests.

Subtasks

@josecelano josecelano self-assigned this Jan 22, 2024
@josecelano josecelano added the Testing Checking Torrust label Jan 22, 2024
@josecelano josecelano added this to the v3.0.0 milestone Jan 22, 2024
@josecelano josecelano mentioned this issue Jan 22, 2024
3 tasks
@josecelano josecelano added the EPIC Contains several subissues label Jan 22, 2024
@josecelano josecelano changed the title E2E tests: console command to run checks E2E tests runner: console command to run checks Jan 30, 2024
@josecelano josecelano changed the title E2E tests runner: console command to run checks Tracker Checker: console command to run tracker checks Jan 30, 2024
@josecelano
Copy link
Member Author

If you want to check the live demo you can use this configuration:

{
    "udp_trackers": [
        "144.126.245.19:6969"
    ],
    "http_trackers": [
        "https://tracker.torrust-demo.com"
    ],
    "health_checks": [
        "https://tracker.torrust-demo.com/api/health_check"
    ]
}
cargo run --bin tracker_checker -- --config-path "./tracker_checker.json"

NOTICE: the /announce path is not included.

The current output is:

image

@josecelano
Copy link
Member Author

You can also run it without creating the config file with:

TORRUST_CHECKER_CONFIG='{
    "udp_trackers": ["144.126.245.19:6969"],
    "http_trackers": ["https://tracker.torrust-demo.com"],
    "health_checks": ["https://tracker.torrust-demo.com/api/health_check"]
}' cargo run --bin tracker_checker

@josecelano
Copy link
Member Author

josecelano commented Jan 30, 2024

The Tracker Checher does not work with trackers that respond with other fields. For example, this won't work:

TORRUST_CHECKER_CONFIG='{
    "udp_trackers": ["104.21.73.163:80"],
    "http_trackers": ["https://tracker.gbitt.info:443"],
    "health_checks": []
}' cargo run --bin tracker_checker

This is the tracker: https://www.gbitt.info/

Probably the announce and scrape responses have more fields than the one we deserialize.

Running checks for trackers ...
UDP trackers ...
✓ - UDP tracker at udp://104.21.73.163:80 is OK (TODO)
HTTP trackers ...
✗ - Announce at https://tracker.gbitt.info/ is failing
thread 'main' panicked at src/shared/bit_torrent/tracker/http/client/responses/scrape.rs:33:46:
provided bytes should be a valid bencoded response: EndOfStream
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@josecelano
Copy link
Member Author

josecelano commented Feb 1, 2024

You can run the checker for the local env or live demo.

Local dev env

Command:

TORRUST_CHECKER_CONFIG='{
    "udp_trackers": ["127.0.0.1:6969"],
    "http_trackers": ["http://127.0.0.1:7070"],
    "health_checks": ["http://127.0.0.1:1313/health_check"]
}' cargo run --bin tracker_checker

Output:

Running checks for trackers ...
UDP trackers ...
✓ - Announce at 127.0.0.1:6969 is OK
✓ - Announce 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

Live demo

Command:

TORRUST_CHECKER_CONFIG='{
    "udp_trackers": ["144.126.245.19:6969"],
    "http_trackers": ["https://tracker.torrust-demo.com"],
    "health_checks": ["https://tracker.torrust-demo.com/health_check"]
}' cargo run --bin tracker_checker

Output:

Running checks for trackers ...
UDP trackers ...
✓ - Announce at 144.126.245.19:6969 is OK
✓ - Announce at 144.126.245.19:6969 is OK
HTTP trackers ...
✓ - Announce at https://tracker.torrust-demo.com/ is OK
✓ - Scrape at https://tracker.torrust-demo.com/ is OK
Health checks ...
✓ - Health API at https://tracker.torrust-demo.com/health_check is OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EPIC Contains several subissues Testing Checking Torrust
Projects
Status: Done
Development

No branches or pull requests

1 participant