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

Add a test verifying initial startup sequence #97

Merged
merged 2 commits into from
Jul 13, 2022
Merged

Conversation

rabbbit
Copy link
Contributor

@rabbbit rabbbit commented Jul 10, 2022

See #95 (comment)

From that discussion I wasn't sure whether the proposed the initial
startup sequence of the limiter - i.e. whether at startup we always
block, or always allow.

Since we didn't seem to have that codified (perhaps apart from the
example_test.go) this PR adds a test to verify this.

This is still slightly (2/1000) flaky, but I think that's good enough
to add this in - should be valuable anyway.

@codecov
Copy link

codecov bot commented Jul 10, 2022

Codecov Report

Merging #97 (a0a8d91) into main (29ac3a2) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main       #97   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           97        97           
=========================================
  Hits            97        97           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29ac3a2...a0a8d91. Read the comment docs.

See #95 (comment)

From that discussion I wasn't sure whether the proposed the initial
startup sequence of the limiter - i.e. whether at startup we always
block, or always allow.

Since we didn't seem to have that codified (perhaps apart from the
`example_test.go`) this PR adds a test to verify this.

This is still slightly (2/1000) flaky, but I think that's good enough
to add this in - should be valuable anyway.
@rabbbit
Copy link
Contributor Author

rabbbit commented Jul 10, 2022

Well this one clearly needs more work.

Works fine 998/1000 on my machine, but github runner is consistently unhappy.

@rabbbit
Copy link
Contributor Author

rabbbit commented Jul 10, 2022

Well this one clearly needs more work.

Works fine 998/1000 on my machine, but github runner is consistently unhappy.

Turns out I just wasn't running -race locally. This is interesting though - because we have RL the code should not be racy, but the race detector (I think) has no way of knowing this.

@rabbbit
Copy link
Contributor Author

rabbbit commented Jul 11, 2022

@storozhukBM Could you take a look?

Irrespective of the implementation changes I think we have a gap WRT behavior on the initial few requests. This seems useful to formalize in tests.

Copy link
Contributor

@storozhukBM storozhukBM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rabbbit rabbbit merged commit 2cba897 into main Jul 13, 2022
@rabbbit rabbbit deleted the pawel/initial branch July 13, 2022 22:03
storozhukBM pushed a commit to storozhukBM/ratelimit that referenced this pull request Jul 13, 2022
* Add a test verifying initial startup sequence

See uber-go#95 (comment)

From that discussion I wasn't sure whether the proposed the initial
startup sequence of the limiter - i.e. whether at startup we always
block, or always allow.

Since we didn't seem to have that codified (perhaps apart from the
`example_test.go`) this PR adds a test to verify this.

This is still slightly (2/1000) flaky, but I think that's good enough
to add this in - should be valuable anyway.

* channels are great
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants