use of com.google.gerrit.acceptance.ChangeIndexedCounter in project gerrit by GerritCodeReview.
the class IndexChangesIT method indexVisibleChange.
@Test
public void indexVisibleChange() throws Exception {
ChangeIndexedCounter changeIndexedCounter = new ChangeIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(changeIndexedCounter)) {
String changeId = createChange().getChangeId();
IndexChanges.Input in = new IndexChanges.Input();
in.changes = ImmutableSet.of(changeId);
changeIndexedCounter.clear();
adminRestSession.post("/config/server/index.changes", in).assertOK();
assertThat(changeIndexedCounter.getCount(info(changeId))).isEqualTo(1);
}
}
use of com.google.gerrit.acceptance.ChangeIndexedCounter in project gerrit by GerritCodeReview.
the class AbstractIndexTests method indexProject.
@Test
@GerritConfig(name = "index.autoReindexIfStale", value = "false")
public void indexProject() throws Exception {
ChangeIndexedCounter changeIndexedCounter = new ChangeIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(changeIndexedCounter)) {
PushOneCommit.Result change = createChange("first change", "test1.txt", "test1");
String changeId = change.getChangeId();
ChangeInfo changeInfo = gApi.changes().id(changeId).get();
disableChangeIndexWrites();
amendChange(changeId, "second test", "test2.txt", "test2");
assertChangeQuery(change.getChange(), false);
enableChangeIndexWrites();
changeIndexedCounter.clear();
String cmd = Joiner.on(" ").join("gerrit", "index", "changes-in-project", project.get());
adminSshSession.exec(cmd);
adminSshSession.assertSuccess();
boolean indexing = true;
while (indexing) {
String out = adminSshSession.exec("gerrit show-queue --wide");
adminSshSession.assertSuccess();
indexing = out.contains("Index all changes of project " + project.get());
}
changeIndexedCounter.assertReindexOf(changeInfo, 1);
assertChangeQuery(change.getChange(), true);
}
}
Aggregations