PostReview#forceCallerAsReviewer should set reviewer in notedb
This problem was revealed when using ChangeNotes.Factory in AbstractQueryChangesTest#updatedOrderWithSubMinuteResolution to load the change after a review has been posted. Using ChangeNotes.Factory for loading the change instead of loading it directly from the database means that we now get the change from notedb when it is enabled. The test started to fail because posting the empty review didn't result in any update in the notedb, while the change in the database was updated by adding the caller as reviewer. For notedb we should do the same and add the caller as reviewer. Another problem when loading the change via notedb was that the timestamps are only precise up to 1s, while loading the change from the database leads to 1ms precise timestamps. E.g. when the timestamp from the database is 2009-09-30 23:00:00.004 the same timestamp from notedb is 2009-09-30 23:00:00.0 As result the timestamp comparison failed. To fix this the clock step for this test had to be set to 1s. Also fixing PostReview#forceCallerAsReviewer caused the CustomLabelIT#customLabelAnyWithBlock_Addreviewer_ZeroVote to fail because it was wrongly expecting only one approval when notedb was enabled. This was done by change I321f84 which assumed that with notedb no approvals are returned for reviewers that haven't voted because notedb doesn't insert a dummy approval for them. While it is true that no dummy approval is inserted, still the presense of a reviewer leads to an empty approval being returned (see ChangeJson#setAllApprovals). Change-Id: I13caedaddfe37986bfe1bd8e4c9916acde501c5f Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -600,6 +600,8 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
||||
ups.add(c);
|
||||
}
|
||||
}
|
||||
ctx.getUpdate(ctx.getChange().currentPatchSetId())
|
||||
.putReviewer(user.getAccountId(), REVIEWER);
|
||||
}
|
||||
|
||||
private Map<String, PatchSetApproval> scanLabels(ChangeContext ctx,
|
||||
|
Reference in New Issue
Block a user