Allow to switch Note DB on or off for server tests
Introduce a new base class, GerritServerTests, that can cause derived test classes to run with or without the note DB enabled, depending on the value of the GERRIT_ENABLE_NOTEDB environment variable. Tests can be run with note DB enabled by: GERRIT_ENABLE_NOTEDB=Y buck test --no-results-cache Setting the variable to any of the values 'Y', 'YES' or 'TRUE' (case insensitive) will cause the note DB to be enabled for the tests. The --no-results-cache option must be used when alternating between on and off, so that buck correctly re-runs the tests. Update existing tests that currently run with multiple configurations (default, and note DB enabled) to use the new base class. Remove the isNoteDbTestEnabled method from AbstractDaemonTest and instead static import the one now defined in GerritServerTests. Change-Id: Id30d6a622ec3d2e05ea0bec300c85a080ec8c053
This commit is contained in:
@@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.gerrit.acceptance.GitUtil.initSsh;
|
||||
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||
import static com.google.gerrit.server.project.Util.block;
|
||||
import static com.google.gerrit.testutil.GerritServerTests.isNoteDbTestEnabled;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
@@ -233,13 +234,6 @@ public abstract class AbstractDaemonTest {
|
||||
return cfg.getBoolean("change", null, "submitWholeTopic", false);
|
||||
}
|
||||
|
||||
private static boolean isNoteDbTestEnabled() {
|
||||
final String[] RUN_FLAGS = {"yes", "y", "true"};
|
||||
String value = System.getenv("GERRIT_ENABLE_NOTEDB");
|
||||
return value != null &&
|
||||
Arrays.asList(RUN_FLAGS).contains(value.toLowerCase());
|
||||
}
|
||||
|
||||
protected void beforeTest(Description description) throws Exception {
|
||||
GerritServer.Description classDesc =
|
||||
GerritServer.Description.forTestClass(description, configName);
|
||||
|
||||
Reference in New Issue
Block a user