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 stats: add E2E tests for the global metrics #1407

Closed
Tracked by #1263
josecelano opened this issue Mar 21, 2025 · 0 comments · Fixed by #1410
Closed
Tracked by #1263

Overhaul stats: add E2E tests for the global metrics #1407

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

Comments

@josecelano
Copy link
Member

Before implementing the segregate metrics I want to add some integration tests for the global metrics.

While I was working on #1404 I realized we don't have integration tests for that. There are tests for a single server. For example:

The tests use the test environment to create a single instance of the HTTP or UDP trackers.

We need to add a new tests at the application level at least with one test for each tracker type:

  • Run the whole tracker with the HTTP tracker enabled.
  • Make an announce request.
  • Get the global metrics from the REST API.
  • Check that the counter for announce request was increased.

Same for UDP tracker.

I don't know yet if we can use an E2E test:

https://github.com/torrust/torrust-tracker/blob/develop/src/console/ci/e2e/runner.rs

Or maybe we can create a new integration tests running the whole app.

I think the first option is faster to implement but slower to execute (it's using docker). I would prefer the second option. If it takes too long I would do it with E2E tests for now. Global metrics is something we are going to remove in future versions and the main app bootstrapping (containers and jobs) is not changed very often.

cc @da2ce7

@josecelano josecelano added - Developer - Torrust Improvement Experience Quality & Assurance Relates to QA, Testing, and CI Testing Checking Torrust labels Mar 21, 2025
@josecelano josecelano self-assigned this Mar 21, 2025
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Mar 24, 2025

Verified

This commit was signed with the committer’s verified signature.
josecelano Jose Celano
A new integration test that checks that the global metrics are udapted
when you run 2 HTTP trackers.

Ony one metric is checked in this test.

It uses fixed port that migth conflict with other running instances in
the future. We should use a random free port if we run more integration tests like this in the future.
@josecelano josecelano linked a pull request Mar 24, 2025 that will close this issue
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Mar 24, 2025

Verified

This commit was signed with the committer’s verified signature.
josecelano Jose Celano
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Mar 24, 2025

Verified

This commit was signed with the committer’s verified signature.
josecelano Jose Celano
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Mar 24, 2025

Verified

This commit was signed with the committer’s verified signature.
josecelano Jose Celano
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Mar 24, 2025

Verified

This commit was signed with the committer’s verified signature.
josecelano Jose Celano
josecelano added a commit that referenced this issue Mar 24, 2025

Verified

This commit was signed with the committer’s verified signature.
josecelano Jose Celano
b53da07 refactor: [#1407] remove duplicate code (Jose Celano)
aff065c fix: [#1407] docker build after adding new integration test (Jose Celano)
4e59dd7 refactor: [#1407] rename (Jose Celano)
398ad9b refactor: remove duplicate code (Jose Celano)
eeea77a chore: remove sample integration test (Jose Celano)
8510990 test: [#1407] add test for global metrics with 2 http trackers (Jose Celano)

Pull request description:

  A new integration test that checks that the global metrics are updated when you run 2 HTTP trackers. Only one metric is checked in this test.

  It uses fixed ports that might conflict with other running instances in the future. We should use a random free port if we run more integration tests like this in the future.

  The rest of the functionality is already tested at the package level with only one tracker.

  I've added to make sure nothing is broken while working on the [stats overhaul](#1327).

ACKs for top commit:
  josecelano:
    ACK b53da07

Tree-SHA512: 2b3a5758532a42c595497b506e8c861f8a3a499f20fa6515a36de76949a6850bc65c767a8c6d8bd2c20eb58a808b6cff7276359faec6268438a30bbbb995a818
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