[BEAM-13870] [Playground] Increase test coverage for the cache package#16826
Conversation
KhaninArtur
left a comment
There was a problem hiding this comment.
The tests are LGTM, could you please also add comments to all others so it is easier to read them? That would help very much, thanks!
| // Test case with calling GetValue method with exist value the expiration time of which has ended. | ||
| // As a result, want to receive an error. |
There was a problem hiding this comment.
Thank you for adding these comments, could you please also add comments for other tests in these files? So every test in local_cache_test.go and redis_cache_test.go has a corresponding comment😊
| { | ||
| // Test case with calling startGC method with nil items. | ||
| // As a result, items stay the same. | ||
| name: "Checking for deleting expired pipelines with nil items", |
| want *Cache | ||
| }{ | ||
| { | ||
| // Test case with calling New method. |
| wantErr: false, | ||
| }, | ||
| { | ||
| // Test case with calling SetValue method with incorrect value. |
| }, | ||
| { | ||
| // Test case with calling unmarshalBySubKey method with Canceled subKey. | ||
| // As a result, want to receive false. |
There was a problem hiding this comment.
Why it will be false?
There was a problem hiding this comment.
@daria-malkova because canceledValue is JSON encoding of the false.
| wantErr bool | ||
| }{ | ||
| { | ||
| // Test case with calling SetExpTime method with pipelineId and his expiration time. |
| wantErr: true, | ||
| }, | ||
| { | ||
| // Test case with calling GetValue method with existing value that is expiring. |
| wantErr: false, | ||
| }, | ||
| { | ||
| // Test case with calling SetValue method with RunOutputIndex subKey. |
| wantErr: false, | ||
| }, | ||
| { | ||
| // Test case with calling SetExpTime method with pipelineId which not set in cache and expiration time. |
| }, | ||
| { | ||
| name: "all success", | ||
| name: "get existing value", |
There was a problem hiding this comment.
Sometimes you have a name with an upper case letter, but sometimes with lower case. Do the same everywhere
There was a problem hiding this comment.
I agree, let's start all test names with upper case letters.
E.g. here
| name: "get existing value", | |
| name: "Get existing value", |
KhaninArtur
left a comment
There was a problem hiding this comment.
Let's finalize the naming and address Daria's comments. Then we'll be good to go🙂
| }, | ||
| { | ||
| name: "all success", | ||
| name: "get existing value", |
There was a problem hiding this comment.
I agree, let's start all test names with upper case letters.
E.g. here
| name: "get existing value", | |
| name: "Get existing value", |
|
R: @pabloem |
|
LGTM |
[BEAM-13870]
Add unit tests to increase test coverage for the cache package
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
ValidatesRunnercompliance status (on master branch)Examples testing status on various runners
Post-Commit SDK/Transform Integration Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.