Fix non-determinism in RegistryTest duplicate auth code test

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149576311
This commit is contained in:
mcilwain 2017-03-08 13:32:41 -08:00 committed by Ben McIlwain
parent d4a428fc24
commit 27b9244126
2 changed files with 7 additions and 4 deletions

View file

@ -36,10 +36,10 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Ordering;
import com.google.common.collect.Range;
@ -761,7 +761,7 @@ public class Registry extends ImmutableObject implements Buildable {
* Checks that domain names don't have conflicting auth codes across different reserved lists.
*/
private static void checkAuthCodeConflicts(Set<ReservedList> reservedLists) {
Multimap<String, String> allAuthCodes = HashMultimap.create();
Multimap<String, String> allAuthCodes = LinkedHashMultimap.create();
for (ReservedList list : reservedLists) {
for (ReservedListEntry entry : list.getReservedListEntries().values()) {
if (entry.getAuthCode() != null) {

View file

@ -196,11 +196,14 @@ public class RegistryTest extends EntityTestCase {
"tld-reserved056",
"lol,RESERVED_FOR_ANCHOR_TENANT,conflict2",
"tim,FULLY_BLOCKED");
ReservedList rl3 = persistReservedList(
"tld-reserved057",
"lol,RESERVED_FOR_ANCHOR_TENANT,another_conflict");
thrown.expect(
IllegalArgumentException.class,
"auth code conflicts for labels: [lol=[conflict1, conflict2]]");
"auth code conflicts for labels: [lol=[conflict1, conflict2, another_conflict]]");
@SuppressWarnings("unused")
Registry unused = Registry.get("tld").asBuilder().setReservedLists(rl1, rl2).build();
Registry unused = Registry.get("tld").asBuilder().setReservedLists(rl1, rl2, rl3).build();
}
@Test