mirror of
https://github.com/google/nomulus.git
synced 2025-08-02 07:52:11 +02:00
Add TestCacheExtension in ResourceFlowTC to fix flakes (#1749)
Basically, what's happening here is that some flow tests are adding things to the claims list cache which is stored statically, meaning that some other tests can pick those up when they shouldn't. By adding the extension in RFTC, it'll clear out the caches after each test.
This commit is contained in:
parent
22193474d5
commit
4e21152f04
1 changed files with 6 additions and 0 deletions
|
@ -40,6 +40,7 @@ import google.registry.model.tmch.ClaimsList;
|
|||
import google.registry.model.tmch.ClaimsListDao;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import google.registry.testing.TaskQueueHelper.TaskMatcher;
|
||||
import google.registry.testing.TestCacheExtension;
|
||||
import google.registry.util.JdkLoggerConfig;
|
||||
import google.registry.util.TypeUtils.TypeInstantiator;
|
||||
import java.util.logging.Level;
|
||||
|
@ -48,6 +49,7 @@ import org.joda.time.DateTime;
|
|||
import org.joda.time.Duration;
|
||||
import org.json.simple.JSONValue;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
/**
|
||||
* Base class for resource flow unit tests.
|
||||
|
@ -60,6 +62,10 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
|
|||
|
||||
private final TestLogHandler logHandler = new TestLogHandler();
|
||||
|
||||
@RegisterExtension
|
||||
public final TestCacheExtension testCacheExtension =
|
||||
new TestCacheExtension.Builder().withClaimsListCache(java.time.Duration.ofHours(6)).build();
|
||||
|
||||
@BeforeEach
|
||||
void beforeResourceFlowTestCase() {
|
||||
// Attach TestLogHandler to the root logger so it has access to all log messages.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue