From 6dd96c247a78e8f1ea26a77628d003c794fe71b1 Mon Sep 17 00:00:00 2001 From: gbrodman Date: Mon, 22 Aug 2022 15:58:45 -0400 Subject: [PATCH] Reset the claims list cache in any test that saves to it (#1754) --- .../google/registry/tools/GetClaimsListCommandTest.java | 6 ++++++ .../google/registry/tools/UploadClaimsListCommandTest.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/core/src/test/java/google/registry/tools/GetClaimsListCommandTest.java b/core/src/test/java/google/registry/tools/GetClaimsListCommandTest.java index a47e296c9..9d7c51eb8 100644 --- a/core/src/test/java/google/registry/tools/GetClaimsListCommandTest.java +++ b/core/src/test/java/google/registry/tools/GetClaimsListCommandTest.java @@ -22,14 +22,20 @@ import static org.joda.time.DateTimeZone.UTC; import com.google.common.collect.ImmutableMap; import google.registry.model.tmch.ClaimsList; import google.registry.model.tmch.ClaimsListDao; +import google.registry.testing.TestCacheExtension; import java.io.File; import java.nio.file.Files; import org.joda.time.DateTime; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; /** Unit tests for {@link GetClaimsListCommand}. */ class GetClaimsListCommandTest extends CommandTestCase { + @RegisterExtension + public final TestCacheExtension testCacheExtension = + new TestCacheExtension.Builder().withClaimsListCache(java.time.Duration.ofHours(6)).build(); + @Test void testSuccess_getWorks() throws Exception { ClaimsListDao.save(ClaimsList.create(DateTime.now(UTC), ImmutableMap.of("a", "1", "b", "2"))); diff --git a/core/src/test/java/google/registry/tools/UploadClaimsListCommandTest.java b/core/src/test/java/google/registry/tools/UploadClaimsListCommandTest.java index fab1886f4..48433bc4a 100644 --- a/core/src/test/java/google/registry/tools/UploadClaimsListCommandTest.java +++ b/core/src/test/java/google/registry/tools/UploadClaimsListCommandTest.java @@ -20,13 +20,19 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import google.registry.model.tmch.ClaimsList; import google.registry.model.tmch.ClaimsListDao; +import google.registry.testing.TestCacheExtension; import java.io.FileNotFoundException; import org.joda.time.DateTime; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; /** Unit tests for {@link UploadClaimsListCommand}. */ class UploadClaimsListCommandTest extends CommandTestCase { + @RegisterExtension + public final TestCacheExtension testCacheExtension = + new TestCacheExtension.Builder().withClaimsListCache(java.time.Duration.ofHours(6)).build(); + @Test void testSuccess() throws Exception { String filename = writeToTmpFile(