Merge changes I8e67dc88,Ib7cdcd97

* changes:
  Don't fuse code and meta ref updates if it won't be atomic
  TestNotesMigration: Initialize from env during constructor
This commit is contained in:
Dave Borowitz
2017-04-25 13:55:55 +00:00
committed by Gerrit Code Review
15 changed files with 615 additions and 50 deletions

View File

@@ -896,7 +896,14 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
PushResult pr =
GitUtil.pushHead(testRepo, "refs/for/foo%base=" + rBase.getCommit().name(), false, false);
assertThat(pr.getMessages()).contains("changes: new: 1, refs: 1, done");
if (notesMigration.fuseUpdates()) {
// InMemoryRepository's atomic BatchRefUpdate implementation doesn't update the progress
// monitor. That's fine, we just care that there was at least one new change and no errors.
assertThat(pr.getMessages()).contains("changes: new: 1, done");
} else {
assertThat(pr.getMessages()).contains("changes: new: 1, refs: 1, done");
}
assertTwoChangesWithSameRevision(r);
}

View File

@@ -31,7 +31,6 @@ import com.google.gerrit.server.update.BatchUpdate;
import com.google.gerrit.server.update.BatchUpdateOp;
import com.google.gerrit.server.update.ChangeContext;
import com.google.gerrit.server.update.RepoContext;
import com.google.gerrit.testutil.NoteDbMode;
import com.google.inject.Inject;
import java.io.IOException;
import java.util.EnumSet;
@@ -48,11 +47,12 @@ public class NoteDbOnlyIT extends AbstractDaemonTest {
@Before
public void setUp() throws Exception {
assume().that(NoteDbMode.get()).isEqualTo(NoteDbMode.DISABLE_CHANGE_REVIEW_DB);
assume().that(notesMigration.disableChangeReviewDb()).isTrue();
}
@Test
public void updateChangeFailureRollsBackRefUpdate() throws Exception {
assume().that(notesMigration.fuseUpdates()).isTrue();
PushOneCommit.Result r = createChange();
Change.Id id = r.getChange().getId();