From fbdee623defb314604a780d6f2e0d27bed4b4ece Mon Sep 17 00:00:00 2001 From: Michael Muller Date: Fri, 25 Feb 2022 13:09:36 -0500 Subject: [PATCH] Don't reset the update time for TLD updates (#1532) * Don't reset the update time for TLD updates It turns out that the reason that the Registrar update timestamp isn't updated for some of the tests is because the record is updated unchanged. We can avoid this problem by not trying to update the registrar to the same value. So in this case, if the registrar alreay contains the TLD we're adding, don't try to add it. --- .../java/google/registry/model/registrar/Registrar.java | 1 - .../test/java/google/registry/testing/DatabaseHelper.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/google/registry/model/registrar/Registrar.java b/core/src/main/java/google/registry/model/registrar/Registrar.java index b85ceceff..69e71ac44 100644 --- a/core/src/main/java/google/registry/model/registrar/Registrar.java +++ b/core/src/main/java/google/registry/model/registrar/Registrar.java @@ -825,7 +825,6 @@ public class Registrar extends ImmutableObject public Builder setAllowedTlds(Set allowedTlds) { getInstance().allowedTlds = ImmutableSortedSet.copyOf(assertTldsExist(allowedTlds)); - getInstance().lastUpdateTime = UpdateAutoTimestamp.create(null); return this; } diff --git a/core/src/test/java/google/registry/testing/DatabaseHelper.java b/core/src/test/java/google/registry/testing/DatabaseHelper.java index 564ae6b3c..753c3bd99 100644 --- a/core/src/test/java/google/registry/testing/DatabaseHelper.java +++ b/core/src/test/java/google/registry/testing/DatabaseHelper.java @@ -472,8 +472,10 @@ public class DatabaseHelper { public static void allowRegistrarAccess(String registrarId, String tld) { Registrar registrar = loadRegistrar(registrarId); - persistResource( - registrar.asBuilder().setAllowedTlds(union(registrar.getAllowedTlds(), tld)).build()); + if (!registrar.getAllowedTlds().contains(tld)) { + persistResource( + registrar.asBuilder().setAllowedTlds(union(registrar.getAllowedTlds(), tld)).build()); + } } public static void disallowRegistrarAccess(String registrarId, String tld) {