Add test coverage for decoding pending reviewers

Pending reviewers are a stored field in the change index. This test
helps ensure that change index implementations properly support decoding
data stored with the pendingreviewers and pendingreviewersbyemail fields.

This new test revealed an error in ElasticChangeIndex, which is now
fixed.

Bug: Issue 6832
Change-Id: Iefa81e4a7c7eab029196d27e38e03ff8488286c1
This commit is contained in:
Logan Hanks
2017-07-25 09:38:34 -07:00
parent 8e2036ee1a
commit f3c46dd790
2 changed files with 88 additions and 1 deletions

View File

@@ -357,7 +357,8 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
if (source.get(ChangeField.PENDING_REVIEWER.getName()) != null) {
cd.setPendingReviewers(
ChangeField.parseReviewerFieldValues(
FluentIterable.from(source.get(ChangeField.REVIEWER.getName()).getAsJsonArray())
FluentIterable.from(
source.get(ChangeField.PENDING_REVIEWER.getName()).getAsJsonArray())
.transform(JsonElement::getAsString)));
} else if (fields.contains(ChangeField.PENDING_REVIEWER.getName())) {
cd.setPendingReviewers(ReviewerSet.empty());