Search in sources :

Example 16 with UseClockStep

use of com.google.gerrit.acceptance.UseClockStep in project gerrit by GerritCodeReview.

the class SubmoduleSubscriptionsIT method superRepoCommitHasSameAuthorAsSubmoduleCommit.

@Test
@UseClockStep
public void superRepoCommitHasSameAuthorAsSubmoduleCommit() throws Exception {
    // Make sure that the commit is created at an earlier timestamp than the submit timestamp.
    allowMatchingSubmoduleSubscription(subKey, "refs/heads/master", superKey, "refs/heads/master");
    createSubmoduleSubscription(superRepo, "master", subKey, "master");
    PushOneCommit.Result pushResult = createChange(subRepo, "refs/heads/master", "Change", "a.txt", "some content", null);
    approve(pushResult.getChangeId());
    gApi.changes().id(pushResult.getChangeId()).current().submit();
    // Expect that the author name/email is preserved for the superRepo commit, but a new author
    // timestamp is used.
    PersonIdent authorIdent = getAuthor(superRepo, "master");
    assertThat(authorIdent.getName()).isEqualTo(admin.fullName());
    assertThat(authorIdent.getEmailAddress()).isEqualTo(admin.email());
    assertThat(authorIdent.getWhen()).isGreaterThan(pushResult.getCommit().getAuthorIdent().getWhen());
}
Also used : PersonIdent(org.eclipse.jgit.lib.PersonIdent) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Test(org.junit.Test) UseClockStep(com.google.gerrit.acceptance.UseClockStep)

Aggregations

UseClockStep (com.google.gerrit.acceptance.UseClockStep)16 Test (org.junit.Test)16 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)13 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)11 GerritConfig (com.google.gerrit.acceptance.config.GerritConfig)8 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)7 ReviewerInput (com.google.gerrit.extensions.api.changes.ReviewerInput)6 Project (com.google.gerrit.entities.Project)5 DeleteReviewerInput (com.google.gerrit.extensions.api.changes.DeleteReviewerInput)5 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)4 AccountInfo (com.google.gerrit.extensions.common.AccountInfo)4 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)4 ImmutableList (com.google.common.collect.ImmutableList)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)3 Account (com.google.gerrit.entities.Account)3 GerritJUnit.assertThrows (com.google.gerrit.testing.GerritJUnit.assertThrows)3 Inject (com.google.inject.Inject)3 Config (org.eclipse.jgit.lib.Config)3 PersonIdent (org.eclipse.jgit.lib.PersonIdent)3 ImmutableMap (com.google.common.collect.ImmutableMap)2