Support disabling NoteDb reads for tests
In I0a9eb0ad we fixed a NoteDb-specific issue where loading the default search results page caused ChangeNotes to get loaded, despite not causing changes to load from ReviewDb. Support this configuration in tests by adding a method to NotesMigration that is called in AbstractChangeNotes#load(). In production this method always returns false so the cost is negligible. Change-Id: I22622cb3c834eeb1391d5b80247beafe36fffedf
This commit is contained in:
@@ -22,6 +22,7 @@ import com.google.inject.Singleton;
|
||||
public class TestNotesMigration extends NotesMigration {
|
||||
private volatile boolean readChanges;
|
||||
private volatile boolean writeChanges;
|
||||
private volatile boolean failOnLoad;
|
||||
|
||||
@Override
|
||||
public boolean readChanges() {
|
||||
@@ -43,6 +44,11 @@ public class TestNotesMigration extends NotesMigration {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean failOnLoad() {
|
||||
return failOnLoad;
|
||||
}
|
||||
|
||||
public TestNotesMigration setReadChanges(boolean readChanges) {
|
||||
this.readChanges = readChanges;
|
||||
return this;
|
||||
@@ -53,6 +59,11 @@ public class TestNotesMigration extends NotesMigration {
|
||||
return this;
|
||||
}
|
||||
|
||||
public TestNotesMigration setFailOnLoad(boolean failOnLoad) {
|
||||
this.failOnLoad = failOnLoad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TestNotesMigration setAllEnabled(boolean enabled) {
|
||||
return setReadChanges(enabled).setWriteChanges(enabled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user