Add option to rebuild and check NoteDb after acceptance tests

Similar to GERRIT_ENABLE_NOTEDB, use GERRIT_CHECK_NOTEDB to tell the
test harness to rebuild and check all ChangeBundles immediately before
test server shutdown. We do this once at server shutdown rather than
after each test method since we don't have an easy way to see which
changes were created by a given test method. Plus, this avoids putting
notedb in an awkward partially-migrated state.

This exposes some test failures, but should be submitted sooner rather
than later to enable multiple people to work on fixing up the tests.
And these tests aren't currently run by CI, so it won't block other
Gerrit development.

Change-Id: Ic8ff4722a59177949aa53bc4b0b3e979cce2fd8e
This commit is contained in:
Dave Borowitz
2016-02-25 20:42:41 -05:00
parent 84b8d47193
commit 1bf9bdddd5
4 changed files with 58 additions and 22 deletions

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.reviewdb.server;
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gwtorm.client.IntKey;
/** Static utilities for ReviewDb types. */
@@ -28,6 +29,14 @@ public class ReviewDbUtil {
}
};
private static final Function<Change, Change.Id> CHANGE_ID_FUNCTION =
new Function<Change, Change.Id>() {
@Override
public Change.Id apply(Change in) {
return in.getId();
}
};
private static final Ordering<? extends IntKey<?>> INT_KEY_ORDERING =
Ordering.natural().onResultOf(INT_KEY_FUNCTION);
@@ -36,6 +45,10 @@ public class ReviewDbUtil {
return (Ordering<K>) INT_KEY_ORDERING;
}
public static Function<Change, Change.Id> changeIdFunction() {
return CHANGE_ID_FUNCTION;
}
private ReviewDbUtil() {
}
}