mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 03:30:46 +02:00
Fix timestamp inversion bug (#1144)
* Fix timestamp inversion bug Set the number of commitLog buckets to 1 in CommitLog replay tests to expose all timestamp inversion problems due to replay. Fixed PollAckFlowTest which is related to this problem. Also fixed a few tests that failed to advance the fake clock when they should, using the following approaches: - If DatabaseHelper used but clock is not injected, do it. This allows us to remove some unnecessary manual clock advances. - Manually advance the clock where convenient. - Enable clock autoIncrement mode when calling production classes that performs multiple transactions. We should consider making 1-bucket the default setting for tests. This is left to another PR.
This commit is contained in:
parent
104fc6a5f0
commit
b9e8694792
15 changed files with 71 additions and 53 deletions
|
@ -22,6 +22,7 @@ import google.registry.util.Clock;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
import org.joda.time.ReadableDuration;
|
||||
import org.joda.time.ReadableInstant;
|
||||
|
||||
|
@ -81,4 +82,14 @@ public final class FakeClock implements Clock {
|
|||
public void setTo(ReadableInstant time) {
|
||||
currentTimeMillis.set(time.getMillis());
|
||||
}
|
||||
|
||||
/** Invokes {@link #setAutoIncrementStep} with one millisecond-step. */
|
||||
public FakeClock setAutoIncrementByOneMilli() {
|
||||
return setAutoIncrementStep(Duration.millis(1));
|
||||
}
|
||||
|
||||
/** Disables the auto-increment mode. */
|
||||
public FakeClock disableAutoIncrement() {
|
||||
return setAutoIncrementStep(Duration.ZERO);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue