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
This commit is contained in:
shicong 2019-01-08 12:25:37 -08:00 committed by Shicong Huang
parent a79e254e49
commit 04a495bc99
2 changed files with 47 additions and 51 deletions

View file

@ -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")
})
}
}

View file

@ -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