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

Use tokio::time::advance in the genesis rate-limit test #2270

Closed
2 tasks
teor2345 opened this issue Jun 9, 2021 · 1 comment
Closed
2 tasks

Use tokio::time::advance in the genesis rate-limit test #2270

teor2345 opened this issue Jun 9, 2021 · 1 comment
Labels
A-network Area: Network protocol updates or fixes A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup C-testing Category: These are tests

Comments

@teor2345
Copy link
Contributor

teor2345 commented Jun 9, 2021

Motivation

In #2255, we rate-limited initial genesis block downloads, and added a test for the rate limit.

But we can make the test faster using tokio::time::advance. This speed up will let us test multiple retries.

API Documentation

https://docs.rs/tokio/1.6.1/tokio/time/fn.advance.html

Solution

  • Use pause and advance to change tokio's internal time in the request_genesis_is_rate_limited test
  • Increase the number of retries in the test

Alternatives

We could leave the test as it is, and accept the slower time. (And smaller coverage.)

Related Work

We also want to replace the atomics in the test #2268

@teor2345 teor2345 added A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup S-needs-triage Status: A bug report needs triage P-Low A-network Area: Network protocol updates or fixes labels Jun 9, 2021
@mpguerra mpguerra removed the S-needs-triage Status: A bug report needs triage label Jun 21, 2021
@teor2345 teor2345 added C-testing Category: These are tests P-Optional and removed P-Low labels Dec 16, 2021
@teor2345
Copy link
Contributor Author

teor2345 commented Mar 1, 2022

This cleanup is not required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-network Area: Network protocol updates or fixes A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup C-testing Category: These are tests
Projects
None yet
Development

No branches or pull requests

2 participants