-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add coverage for kv range operations #21025
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nwnt The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted filessee 15 files with indirect coverage changes @@ Coverage Diff @@
## main #21025 +/- ##
==========================================
+ Coverage 68.43% 68.53% +0.10%
==========================================
Files 429 429
Lines 35281 35281
==========================================
+ Hits 24144 24180 +36
+ Misses 9734 9698 -36
Partials 1403 1403 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
2ae8ab1 to
7eb38a6
Compare
|
The lint error is now fixed. |
|
Tests should cover whole range execution, not just rangeLimit function that will be might not be used in the future. For regression testing you want to run as high level test as possible to prove that changing implementation below doesn't change the output. |
|
Yep, I can add the whole tests for range. Thought I was going to start adding them one by one to keep the PRs small, but I can do that too. |
|
We don't do testing to hardcode the reverse behavior of functions, we use them to prevent regressions. While doing small steps and small PRs is very good, we need to remember the goal test that ensures that the behavior of limit in range will not change. This test doesn't achieve this. |
|
Totally understood. Still working on the unit tests for the Range function and will be sending that shortly. |
7eb38a6 to
a07c5ba
Compare
a07c5ba to
f65fb69
Compare
|
@serathius this should look better this time. I believe server's Range ultimately calls Feel free to leave any comments. |
7db9d95 to
67d8714
Compare
|
Bucket buffer is just a buffer for a operations that have not been committed. While testing range should cover this buffer again testing it by itself is not enough |
Signed-off-by: Nont <[email protected]>
67d8714 to
38b7005
Compare
|
@serathius can you have another look at this? I have removed the previous unit tests and added what I think would provide the coverage in common/kv_test.go. I tested these test cases with the following command: PASSES=integration PKG=./tests/common TESTCASE='\bTestKVGet\b' ./scripts/test.sh |
|
@nwnt: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
| description: "a specific key with a specific revision", | ||
| key: "c", | ||
| options: config.GetOptions{ | ||
| Revision: firstRev + 10, // first update on 'c' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please pair this test case with one that shows that second update. Test cases by themselves should show how changing argument impacts results.
| firstRev = int(resp.Header.Revision) | ||
| } | ||
| } | ||
| tests := []struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test cases below remind me of https://github.com/etcd-io/etcd/blob/main/tests/integration/cache_test.go#L579 Might be good to take a look if there are any interesting cases there that are missing here, and maybe unify them at some point in the future.
| options config.GetOptions | ||
|
|
||
| wkv []string | ||
| wkv []testutils.KV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On think I don't like in the test here is that we use a indirect way to express expectation and compare the results. It compares only key/value and skips all the other metadata like ModRevision, CreateRevision etc. Those are still important fields used by clients to build a TXN conditions. I'm worried that a bug can easily slip if we forget to validate them.
Please see how we did it in
etcd/tests/integration/cache_test.go
Line 732 in 05deb60
| var getTestCases = []getTestCase{ |
Adding a small unit test as a small start step for #20386
cc @serathius @joshjms