-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
grpclb: Refactoring GrpclbLoadBalancerTest unit tests #11677
base: master
Are you sure you want to change the base?
Conversation
…h Duration" This reverts commit ab97045.
verify(helper, times(4)).refreshNameResolution(); | ||
} | ||
|
||
private StreamObserver<LoadBalanceResponse> getFastForwardBeforeRetry(int nanos, InOrder inOrder, |
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.
I see the work done by this method aptly suggests it's name to be - fastForwardAndRetry()
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.
Renamed the method
assertEquals(0, fakeClock.numPendingTasks(LB_RPC_RETRY_TASK_FILTER)); | ||
|
||
// Balancer closes it immediately (erroneously) | ||
lbResponseObserver.onCompleted(); |
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.
Move this out to main test method.
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.
Handled as suggested, please review
assertEquals(1, lbRequestObservers.size()); | ||
StreamObserver<LoadBalanceRequest> lbRequestObserver = lbRequestObservers.poll(); | ||
verify(lbRequestObserver).onNext(eq(expectedInitialRequest)); | ||
assertEquals(0, fakeClock.numPendingTasks(LB_RPC_RETRY_TASK_FILTER)); |
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 assertions and verifications here are very common. Can be done differently?
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.
Moved to different method, please review
…_pickFirstMode_lbSendsEmptyAddress
…d, grpclbFallback_allLost_failToFallback, switchMode and its related testcases
Refactoring Unit Test cases for GrpclbLoadBalancerTest.
Fixes #2772