mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Define TestRule that manages cache use in tests
All current tests that use caches with custom data expiry values now restore the default config when teardown. We need to prevent new unsafe uses from being introduced. Restoration code have also been added to a few other tests that modifies static fields. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=228888041
This commit is contained in:
parent
a6476862fd
commit
a80a44cd06
12 changed files with 231 additions and 53 deletions
|
@ -79,9 +79,7 @@ public class RefreshDnsForAllDomainsAction implements Runnable {
|
|||
|
||||
private static final long serialVersionUID = 1455544013508953083L;
|
||||
|
||||
@NonFinalForTesting
|
||||
@VisibleForTesting
|
||||
static DnsQueue dnsQueue = DnsQueue.create();
|
||||
@NonFinalForTesting private static DnsQueue dnsQueue = DnsQueue.create();
|
||||
|
||||
private final ImmutableSet<String> tlds;
|
||||
|
||||
|
@ -109,5 +107,12 @@ public class RefreshDnsForAllDomainsAction implements Runnable {
|
|||
getContext().incrementCounter("domains on non-targeted TLDs skipped");
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static DnsQueue setDnsQueueForTest(DnsQueue testQueue) {
|
||||
DnsQueue currentQueue = dnsQueue;
|
||||
dnsQueue = testQueue;
|
||||
return currentQueue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue