Merge branch 'stable-2.15' into stable-2.16
* stable-2.15: gerrit.sh: Fix PID definition AccountIT: Add test for deleting preferred email AccountIT: Add test coverage of adding an email and setting preferred Adjust AccountIT#deletePreferredEmail to the different behavior on this branch: the account is not reindexed twice when the preferred email is deleted. Change-Id: Icffba48df458f303f261a2189d3baa942d397fb8
This commit is contained in:
@@ -1027,6 +1027,23 @@ public class AccountIT extends AbstractDaemonTest {
|
||||
gApi.accounts().id(user.id.get()).addEmail(newEmailInput(email, false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addEmailAndSetPreferred() throws Exception {
|
||||
String email = "foo.bar@example.com";
|
||||
EmailInput input = new EmailInput();
|
||||
input.email = email;
|
||||
input.noConfirmation = true;
|
||||
input.preferred = true;
|
||||
gApi.accounts().self().addEmail(input);
|
||||
|
||||
// Account is reindexed twice; once on adding the new email,
|
||||
// and then again on setting the email preferred.
|
||||
accountIndexedCounter.assertReindexOf(admin, 2);
|
||||
|
||||
String preferred = gApi.accounts().self().get().email;
|
||||
assertThat(preferred).isEqualTo(email);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteEmail() throws Exception {
|
||||
String email = "foo.bar@example.com";
|
||||
@@ -1044,6 +1061,29 @@ public class AccountIT extends AbstractDaemonTest {
|
||||
assertThat(getEmails()).doesNotContain(email);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deletePreferredEmail() throws Exception {
|
||||
String email = "foo.bar@example.com";
|
||||
EmailInput input = new EmailInput();
|
||||
input.email = email;
|
||||
input.noConfirmation = true;
|
||||
input.preferred = true;
|
||||
gApi.accounts().self().addEmail(input);
|
||||
|
||||
// Account is reindexed twice; once on adding the new email,
|
||||
// and then again on setting the email preferred.
|
||||
accountIndexedCounter.assertReindexOf(admin, 2);
|
||||
|
||||
assertThat(gApi.accounts().self().get().email).isEqualTo(email);
|
||||
|
||||
accountIndexedCounter.clear();
|
||||
gApi.accounts().self().deleteEmail(input.email);
|
||||
accountIndexedCounter.assertReindexOf(admin);
|
||||
|
||||
resetCurrentApiUser();
|
||||
assertThat(getEmails()).doesNotContain(email);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteEmailFromCustomExternalIdSchemes() throws Exception {
|
||||
String email = "foo.bar@example.com";
|
||||
|
||||
@@ -434,8 +434,8 @@ case "$ACTION" in
|
||||
fi
|
||||
fi
|
||||
|
||||
PID=`cat "$GERRIT_PID"`
|
||||
if test $UID = 0; then
|
||||
PID=`cat "$GERRIT_PID"`
|
||||
if test -f "/proc/${PID}/oom_score_adj" ; then
|
||||
echo -1000 > "/proc/${PID}/oom_score_adj"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user