-
Notifications
You must be signed in to change notification settings - Fork 310
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
fix: Do not add user to the top of queue after reject (fixes #4505) #5427
Conversation
…ls#4505) Added a checkbox in the reject review dialog to ask whether user wants to be added to the top of the queue or not. Default is off.
Set the request_assignment_next also in LeastRecentlyUsedReviewerQueuePolicy so it can be used to override the assignment policy rules (i.e., if someone has once per month, but he rejects review with wants_to_be_next set to true, he will get new assignment immediately, not after one month).
The test fails are because of But consider changing
to
With that change, the above two lines (#L512 and #L728) would not need to change. |
Robert Sparks writes:
If you check in what is now broken I can help diagnose better.
Done already.
I don't see how making the parameter optional removes the ability to test the
feature. You're in control of what the tests provide when they call the
method...
Perhaps, but I would like to also know why the tests are failing even
when tests are updated.
--
***@***.***
|
Ok - found it. The confusion is in the similarly named things. The failure you are seeing now is because you changed the signature of the test functions. Note the error
It's not the return_reviewer_to_rotation_top function that's being complained about - it's the definition of the test_return_reviewer_to_rotation_top function. The test framework searches classes derived from TestCase, looking for methods that have names that start with test_ and calls them with no arguments other than self. |
ietf/review/tests_policies.py
Outdated
@@ -507,9 +507,9 @@ def test_default_reviewer_rotation_list_with_nextreviewerinteam(self): | |||
rotation = self.policy.default_reviewer_rotation_list() | |||
self.assertEqual(rotation, available_reviewers[2:] + available_reviewers[:1]) | |||
|
|||
def test_return_reviewer_to_rotation_top(self): | |||
def test_return_reviewer_to_rotation_top(self, person, wants_to_be_next): |
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 signature here should be just (self).
ietf/review/tests_policies.py
Outdated
reviewer = self.append_reviewer() | ||
self.policy.return_reviewer_to_rotation_top(reviewer) | ||
self.policy.return_reviewer_to_rotation_top(reviewer, wants_to_be_next) |
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.
Here, you need to choose a value for wants_to_be_next and pass it in. Call this twice (appending a new reviewer each time), once with False and once with True and check that the right thing happened with likes like what are at 513 below.
It would be good to add tests like that to the other policy test as well
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.
Ok fixed now, and now the tests passes. I test both the wants to be next cases, in both policies. Actually this function is works identically for both policies.
self. Added test cases for test_return_reviewer_to_rotation_top both for RotateAlphabeticallyReviewerQueuePolicyTest and LeastRecentlyUsedReviewerQueuePolicyTest.
reviewer = self.append_reviewer() | ||
self.policy.return_reviewer_to_rotation_top(reviewer, False) | ||
self.assertFalse(self.reviewer_settings_for(reviewer).request_assignment_next) |
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.
Between 731 and 732, I think you need to make a new reviewer for the test (by repeating what's at 729.
That should happen both here and for the other policy.
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.
Why? The first call to return_reviewer_to_rotation_top with parameter False, does not really do anything, it will not modify the request_assignment_next in any way, so it should still be false after that first call. Then on the second call we call it with wanting to be next set to True, and that will cause request_assignment_next to be set in both policies, and then we check that it is now set.
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.
so the unit here is badly named now if all we're doing is setting and testing the "assign me next" bit. If the implementation is really only setting that bit and no other queue manipulation is made, then we should rename this. Otherwise, we'd be missing something moving someone who is already at head of queue (rotation top) to the head of the queue.
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'll add an issue to make that change later.
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 agree that it is badly named. I think this is artifact that there is no clearly defined method of moving someone on the top, other than asking to be next. This function is called in two different situations, once when review request is rejected, and in that case I added the checkbox. It is also called when the document is withdrawn, and in that case this function will be called with wants_to_be_first set to true, as this happens when secretary messed up and assigned something that should not have been assigned, thus it is logical that the reviewer will get new assignment as soon as possible. On the other hand we could add similar checkbox to that location, but as that thing is only used by secretary and very rarely anyways, it might not be needed.
Codecov Report
@@ Coverage Diff @@
## feat/postgres #5427 +/- ##
=================================================
- Coverage 88.80% 88.79% -0.01%
=================================================
Files 285 285
Lines 39525 39538 +13
=================================================
+ Hits 35100 35108 +8
- Misses 4425 4430 +5
... and 5 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
reviewer = self.append_reviewer() | ||
self.policy.return_reviewer_to_rotation_top(reviewer, False) | ||
self.assertFalse(self.reviewer_settings_for(reviewer).request_assignment_next) |
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.
so the unit here is badly named now if all we're doing is setting and testing the "assign me next" bit. If the implementation is really only setting that bit and no other queue manipulation is made, then we should rename this. Otherwise, we'd be missing something moving someone who is already at head of queue (rotation top) to the head of the queue.
reviewer = self.append_reviewer() | ||
self.policy.return_reviewer_to_rotation_top(reviewer, False) | ||
self.assertFalse(self.reviewer_settings_for(reviewer).request_assignment_next) |
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'll add an issue to make that change later.
Added a checkbox in the reject review dialog to ask whether user wants to be added to the top of the queue or not. Default is off.