AccountCreator: Evict account from cache after adding it to group

The AccountState instance which is held in the account cache contains
the internal groups that the account is member of. Hence the account
needs to be evicted from the account cache when its group memberships
are modified.

Missing to evict the account from the cache leads to failures in
SuggestReviewersIT if SSH is disabled. If SSH is enabled another cache
eviction happens when the SSH key is added, and hence the tests succeed.

Change-Id: I600b7af263d0cd8dcd9c614809f34a0a9a19c895
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin 2017-06-08 18:29:42 +02:00
parent cfb5a76489
commit 9e1dc88e1e

View File

@ -119,6 +119,7 @@ public class AccountCreator {
checkArgument(g != null, "group not found: %s", n);
AccountGroupMember m = new AccountGroupMember(new AccountGroupMember.Key(id, g.getId()));
db.accountGroupMembers().insert(Collections.singleton(m));
accountCache.evict(id);
}
}