-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Some docs tests are very slow #1097
Comments
I think I'm going to extract the duplicate code into a new package: These two modules:
will become one in:
Realtes to: #753 This can be the first refactor. In the long term, we can consider using aquatic_http_protocol. I think test execution times should decrease by removing the dependency on the main lib. If not, I will change the docs test to not compile and execute them. There are unit tests covering the same functionality. cc @da2ce7 |
…p-protocol` 2bc44af test: add test for percent_encode_byte_array (Jose Celano) a62ae82 fix: cargo machete warning (Jose Celano) 39716a8 ci: fix testing workflow. Run doc tests for all packages (Jose Celano) c61cc9a fix: doc tests (Jose Celano) 555d5b8 fix: [#1097] by extracting duplicate module (Jose Celano) Pull request description: For now, it only contains percent encoding functions. This removes duplicate code and fixes the problem of slow doc tests. On my machine, it takes 40 seconds to run all doc tests with one job. ```console time cargo test --doc --workspace --jobs=1 real 0m40.443s user 6m6.863s sys 0m22.609s ``` I have also fixed the `testing` workflow, it was using `cargo test --doc` to run doc-tests without including doc-test is workspace packages. ACKs for top commit: josecelano: ACK 2bc44af Tree-SHA512: 82b6cfb3ac40ffce437717d800388ab3f4968dc0e73dbb25eae4160378f8280ec3569381d5b58f8d3884ad839b5be320f43e2e246b527932e72ca8572fa79397
It seems doc-tests are still slow, and they consume a lot of memory. Reported by @mario-nt. This is in my PC: |
@mario-nt and I agreed on:
|
Hi @mario-nt @da2ce7, all the slow tests are in the
Total: 123 seconds 123 seconds is not too long, but that's on my PC. On the GitHub runner, it tasks 3m 39s. I think the good solution would be to move those files to the For now, I will disable this doc test be replacing the following:
With:
For the slow tests, and I will open a new issue to extract generic code in |
Some doc tests were slow becuase they required to compile the main library. The code used from the main library was moved to workspace pacakages and there is no dependency with the main tracker lib. See torrust#1097
… packages c2d134e test: re-enable slow tests (Jose Celano) a7ceb0f refactor: [#1140] move http tracker logic to http-protocol and primitives packages (Jose Celano) Pull request description: Refactor: Move logic to `http-protocol` and `primitives` packages. This will: - Allow sharing that code with other projects. - Allow re-enabling doc tests disabled [here](#1097). - Decouple generic reusable logic from Axum framework. - Improve compilation times. ACKs for top commit: josecelano: ACK c2d134e Tree-SHA512: 00c49567aed10f23e525219a26765ca2e8ce948037785da7622076e7d6de981983cbf3c88f6043631ac7bfc2def2d3161dc954a8f77746c4be48595d09af49ad
Some doc tests are very slow now.
cargo test --doc
These are the ones that take longer:
It can even crash your computer if you don't have enough memory. You can run them with:
cargo test -- --test-threads=1
It would be even slower, but you can execute them.
We have to find out why they are so slow now.
I guess the problem is:
For example, in this test:
We need to compile the main
torrust_tracker
package. FOr this particular case we can extract the functionality to a new package. In fact, it's duplicated. THe comment for the duplication:But in other cases, we can also do the same. If, for some reason, we cannot do it, I would not compile the example for these slow cases.
cc @mario-nt @da2ce7
The text was updated successfully, but these errors were encountered: