From 04a495bc9995274609fe2f1ab4121356fb33e955 Mon Sep 17 00:00:00 2001 From: shicong Date: Tue, 8 Jan 2019 12:25:37 -0800 Subject: [PATCH] Fix Gradle build There were two issues in the Gradle build. 1. Missing soyToJava conversion for newly added google.registry.ui.soy.otesetup. 2. testSuccess_setAllowedTldsUncached_newTldNotInCache in RegistrarTest modified the cache duration to 600 seconds which broke other tests as those tests write to the storage in initiation stage and expect the data to be available in the cache immediately, this requires the duration to be 0. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=228377715 --- gradle/core/build.gradle | 31 +++------ .../model/registrar/RegistrarTest.java | 67 ++++++++++--------- 2 files changed, 47 insertions(+), 51 deletions(-) diff --git a/gradle/core/build.gradle b/gradle/core/build.gradle index 2049a27a6..475fe450f 100644 --- a/gradle/core/build.gradle +++ b/gradle/core/build.gradle @@ -13,34 +13,15 @@ def generatedDir = "${project.buildDir}/generated/source/custom/main" def outcastTestPatterns = [ "google/registry/batch/DeleteContactsAndHostsActionTest.*", "google/registry/batch/RefreshDnsOnHostRenameActionTest.*", - "google.registry.export.ExportDomainListsActionTest.*", - "google/registry/export/ExportPremiumTermsActionTest.*", - "google/registry/export/ExportReservedTermsActionTest.*", - "google/registry/export/ExportUtilsTest.*", - "google/registry/export/sheet/SyncRegistrarsSheetTest.*", "google/registry/flows/CheckApiActionTest.*", + "google/registry/flows/EppLifecycleHostTest.*", "google/registry/flows/domain/DomainAllocateFlowTest.*", "google/registry/flows/domain/DomainApplicationCreateFlowTest.*", "google/registry/flows/domain/DomainApplicationUpdateFlowTest.*", "google/registry/flows/domain/DomainCreateFlowTest.*", "google/registry/flows/domain/DomainUpdateFlowTest.*", - "google/registry/flows/EppLifecycleDomainTest.*", - "google/registry/flows/EppLifecycleHostTest.*", - "google/registry/model/poll/PollMessageExternalKeyConverterTest.*", - "google/registry/model/poll/PollMessageTest.*", - "google/registry/rdap/RdapDomainActionTest.*", - "google/registry/rdap/RdapDomainSearchActionTest.*", - "google/registry/rdap/RdapEntityActionTest.*", - "google/registry/rdap/RdapEntitySearchActionTest.*", - "google/registry/rdap/RdapNameserverSearchActionTest.*", - "google/registry/reporting/icann/IcannHttpReporterTest.*", - "google/registry/tmch/LordnTaskUtilsTest.*", - "google/registry/tmch/NordnUploadActionTest.*", + "google/registry/tools/CreateDomainCommandTest.*", "google/registry/tools/server/CreatePremiumListActionTest.*", - "google/registry/ui/server/registrar/ContactSettingsTest.*", - "google/registry/ui/server/registrar/RegistrarSettingsActionTest.*", - "google/registry/ui/server/registrar/SecuritySettingsTest.*", - // Conflicts with WhoisActionTest "google/registry/whois/WhoisHttpActionTest.*", ] @@ -374,6 +355,14 @@ task soyToJava { }.filter { it.name.endsWith(".soy") }) + + soyToJava('google.registry.ui.soy.otesetup', + "${generatedDir}/google/registry/ui/soy/otesetup", + files { + file("${javaDir}/google/registry/ui/soy/otesetup").listFiles() + }.filter { + it.name.endsWith(".soy") + }) } } diff --git a/javatests/google/registry/model/registrar/RegistrarTest.java b/javatests/google/registry/model/registrar/RegistrarTest.java index ed095087f..f9fe18cb7 100644 --- a/javatests/google/registry/model/registrar/RegistrarTest.java +++ b/javatests/google/registry/model/registrar/RegistrarTest.java @@ -454,39 +454,46 @@ public class RegistrarTest extends EntityTestCase { @Test public void testSuccess_setAllowedTldsUncached_newTldNotInCache() { - // Cache duration in tests is 0. To make sure the data isn't in the cache we have to set it to a - // higher value and reset the cache. - RegistryConfig.CONFIG_SETTINGS.get().caching.singletonCacheRefreshSeconds = 600; - Registries.resetCache(); - // Make sure the TLD we want to create doesn't exist yet. - // This is also important because getTlds fills out the cache when used. - assertThat(Registries.getTlds()).doesNotContain("newtld"); - // We can't use createTld here because it failes when the cache is used. - persistResource(newRegistry("newtld", "NEWTLD")); - // Make sure we set up the cache correctly, so the newly created TLD isn't in the cache - assertThat(Registries.getTlds()).doesNotContain("newtld"); + try { + // Cache duration in tests is 0. To make sure the data isn't in the cache we have to set it + // to a higher value and reset the cache. + RegistryConfig.CONFIG_SETTINGS.get().caching.singletonCacheRefreshSeconds = 600; + Registries.resetCache(); + // Make sure the TLD we want to create doesn't exist yet. + // This is also important because getTlds fills out the cache when used. + assertThat(Registries.getTlds()).doesNotContain("newtld"); + // We can't use createTld here because it failes when the cache is used. + persistResource(newRegistry("newtld", "NEWTLD")); + // Make sure we set up the cache correctly, so the newly created TLD isn't in the cache + assertThat(Registries.getTlds()).doesNotContain("newtld"); - // Test that the uncached version works - assertThat( - registrar.asBuilder() - .setAllowedTldsUncached(ImmutableSet.of("newtld")) - .build() - .getAllowedTlds()) - .containsExactly("newtld"); + // Test that the uncached version works + assertThat( + registrar + .asBuilder() + .setAllowedTldsUncached(ImmutableSet.of("newtld")) + .build() + .getAllowedTlds()) + .containsExactly("newtld"); - // Test that the "regular" cached version fails. If this doesn't throw - then we changed how the - // cached version works: - // - either we switched to a different cache type/duration, and we haven't actually set up that - // cache in the test - // - or we stopped using the cache entirely and we should rethink if the Uncached version is - // still needed - assertThrows( - IllegalArgumentException.class, - () -> registrar.asBuilder().setAllowedTlds(ImmutableSet.of("newtld"))); + // Test that the "regular" cached version fails. If this doesn't throw - then we changed how + // the cached version works: + // - either we switched to a different cache type/duration, and we haven't actually set up + // that cache in the test + // - or we stopped using the cache entirely and we should rethink if the Uncached version is + // still needed + assertThrows( + IllegalArgumentException.class, + () -> registrar.asBuilder().setAllowedTlds(ImmutableSet.of("newtld"))); - // Make sure the cache hasn't expired during the test and "newtld" is still not in the cached - // TLDs - assertThat(Registries.getTlds()).doesNotContain("newtld"); + // Make sure the cache hasn't expired during the test and "newtld" is still not in the cached + // TLDs + assertThat(Registries.getTlds()).doesNotContain("newtld"); + } finally { + // Set the cache duration back to 0 to satisfy other tests. + RegistryConfig.CONFIG_SETTINGS.get().caching.singletonCacheRefreshSeconds = 0; + Registries.resetCache(); + } } @Test