Convert most NotesMigration#enabled() calls to #readChanges()
Most of the time this is used to avoid codepaths that shouldn't be enabled unless *both* NoteDb reads and writes are enabled. Change-Id: I75958e79e20199f3b19a539bf22b7c3b49a066ee
This commit is contained in:
@@ -1090,7 +1090,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void noteDbCommitsOnPatchSetCreation() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isTrue();
|
||||
assume().that(notesMigration.readChanges()).isTrue();
|
||||
|
||||
PushOneCommit.Result r = createChange();
|
||||
pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT,
|
||||
|
@@ -456,8 +456,8 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void testPushForMasterWithHashtagsNoteDbDisabled() throws Exception {
|
||||
// push with hashtags should fail when noteDb is disabled
|
||||
assume().that(notesMigration.enabled()).isFalse();
|
||||
// Push with hashtags should fail when reading from NoteDb is disabled.
|
||||
assume().that(notesMigration.readChanges()).isFalse();
|
||||
PushOneCommit.Result r = pushTo("refs/for/master%hashtag=tag1");
|
||||
r.assertErrorStatus("cannot add hashtags; noteDb is disabled");
|
||||
}
|
||||
|
@@ -116,7 +116,7 @@ public class CreateChangeIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void noteDbCommit() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isTrue();
|
||||
assume().that(notesMigration.readChanges()).isTrue();
|
||||
|
||||
ChangeInfo c = assertCreateSucceeds(newChangeInput(ChangeStatus.NEW));
|
||||
try (Repository repo = repoManager.openRepository(project);
|
||||
|
@@ -114,7 +114,7 @@ public class HostPageServlet extends HttpServlet {
|
||||
site = sp;
|
||||
refreshHeaderFooter = cfg.getBoolean("site", "refreshHeaderFooter", true);
|
||||
staticServlet = ss;
|
||||
isNoteDbEnabled = migration.enabled();
|
||||
isNoteDbEnabled = migration.readChanges();
|
||||
pluginsLoadTimeout = getPluginsLoadTimeout(cfg);
|
||||
getDiff = diffPref;
|
||||
|
||||
|
@@ -1208,7 +1208,7 @@ public class ReceiveCommits {
|
||||
@Option(name = "--hashtag", aliases = {"-t"}, metaVar = "HASHTAG",
|
||||
usage = "add hashtag to changes")
|
||||
void addHashtag(String token) throws CmdLineException {
|
||||
if (!notesMigration.enabled()) {
|
||||
if (!notesMigration.readChanges()) {
|
||||
throw clp.reject("cannot add hashtags; noteDb is disabled");
|
||||
}
|
||||
String hashtag = cleanupHashtag(token);
|
||||
|
@@ -1087,7 +1087,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
|
||||
@Test
|
||||
public void byHashtagWithoutNoteDb() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isFalse();
|
||||
assume().that(notesMigration.readChanges()).isFalse();
|
||||
setUpHashtagChanges();
|
||||
assertQuery("hashtag:foo");
|
||||
assertQuery("hashtag:bar");
|
||||
@@ -1415,7 +1415,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
|
||||
@Test
|
||||
public void prepopulatedFields() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isFalse();
|
||||
assume().that(notesMigration.readChanges()).isFalse();
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
Change change = insert(repo, newChange(repo));
|
||||
|
||||
@@ -1444,7 +1444,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
|
||||
@Test
|
||||
public void prepopulateOnlyRequestedFields() throws Exception {
|
||||
assume().that(notesMigration.enabled()).isFalse();
|
||||
assume().that(notesMigration.readChanges()).isFalse();
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
Change change = insert(repo, newChange(repo));
|
||||
|
||||
|
Reference in New Issue
Block a user