ConfigNotesMigration: Allow "sequence" option name

checkConfig was helpfully sanity-checking values in the noteDb
sections, and I forgot to add "sequence" as an allowed option. This
was not caught because although the NotesMigration interface got
plenty of testing, it was all via TestNotesMigration in acceptance
tests, not ConfigNotesMigration.

Change-Id: I09f8ad4f049501b99e7770cafc80dcc80d84b2f3
This commit is contained in:
Dave Borowitz
2016-08-04 12:53:40 -04:00
parent c5ec5e97b3
commit 2e2f6ad6b6

View File

@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.gerrit.server.notedb.NoteDbTable.ACCOUNTS;
import static com.google.gerrit.server.notedb.NoteDbTable.CHANGES;
import com.google.common.collect.ImmutableSet;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
@@ -57,12 +58,12 @@ public class ConfigNotesMigration extends NotesMigration {
for (NoteDbTable t : NoteDbTable.values()) {
keys.add(t.key());
}
Set<String> allowed = ImmutableSet.of(READ, WRITE, SEQUENCE);
for (String t : cfg.getSubsections(NOTE_DB)) {
checkArgument(keys.contains(t.toLowerCase()),
"invalid NoteDb table: %s", t);
for (String key : cfg.getNames(NOTE_DB, t)) {
String lk = key.toLowerCase();
checkArgument(lk.equals(WRITE) || lk.equals(READ),
checkArgument(allowed.contains(key.toLowerCase()),
"invalid NoteDb key: %s.%s", t, key);
}
}