mirror of
https://github.com/google/nomulus.git
synced 2025-08-04 17:01:51 +02:00
Restore global config after tests
Fix a couple more cases when caching related configs are changed. This does not fix all our problems with Gradle builds. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=228735790
This commit is contained in:
parent
4866955c76
commit
f94090c415
4 changed files with 50 additions and 24 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.model.registrar;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
|
@ -454,6 +455,11 @@ public class RegistrarTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testSuccess_setAllowedTldsUncached_newTldNotInCache() {
|
||||
int origSingletonCacheRefreshSeconds =
|
||||
RegistryConfig.CONFIG_SETTINGS.get().caching.singletonCacheRefreshSeconds;
|
||||
// Sanity check for Gradle-based open-source build.
|
||||
checkState(
|
||||
origSingletonCacheRefreshSeconds == 0, "singletonCacheRefreshSeconds expected to be 0.");
|
||||
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.
|
||||
|
@ -490,8 +496,8 @@ public class RegistrarTest extends EntityTestCase {
|
|||
// 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;
|
||||
RegistryConfig.CONFIG_SETTINGS.get().caching.singletonCacheRefreshSeconds =
|
||||
origSingletonCacheRefreshSeconds;
|
||||
Registries.resetCache();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue