mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 23:32:16 +00:00
Use setMockClock instead of rollMockClock(0) to resolve flaky tests.
This commit is contained in:
parent
51b71a4363
commit
4df59adeb9
@ -510,8 +510,8 @@ public class Utils {
|
|||||||
/**
|
/**
|
||||||
* Sets the mock clock to the given time (in seconds).
|
* Sets the mock clock to the given time (in seconds).
|
||||||
*/
|
*/
|
||||||
public static void setMockClock(long mockClock) {
|
public static void setMockClock(long mockClockSeconds) {
|
||||||
mockTime = new Date(mockClock * 1000);
|
mockTime = new Date(mockClockSeconds * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ public class BasicKeyChainTest {
|
|||||||
@Test
|
@Test
|
||||||
public void importKeys() {
|
public void importKeys() {
|
||||||
long now = Utils.currentTimeSeconds();
|
long now = Utils.currentTimeSeconds();
|
||||||
Utils.rollMockClock(0);
|
Utils.setMockClock(now);
|
||||||
final ECKey key1 = new ECKey();
|
final ECKey key1 = new ECKey();
|
||||||
Utils.rollMockClock(86400);
|
Utils.rollMockClock(86400);
|
||||||
final ECKey key2 = new ECKey();
|
final ECKey key2 = new ECKey();
|
||||||
@ -185,7 +185,7 @@ public class BasicKeyChainTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializationUnencrypted() throws UnreadableWalletException {
|
public void serializationUnencrypted() throws UnreadableWalletException {
|
||||||
Utils.rollMockClock(0);
|
Utils.setMockClock();
|
||||||
Date now = Utils.now();
|
Date now = Utils.now();
|
||||||
final ECKey key1 = new ECKey();
|
final ECKey key1 = new ECKey();
|
||||||
Utils.rollMockClock(5000);
|
Utils.rollMockClock(5000);
|
||||||
|
@ -45,7 +45,7 @@ public class KeyChainGroupTest {
|
|||||||
|
|
||||||
public KeyChainGroupTest() {
|
public KeyChainGroupTest() {
|
||||||
BriefLogFormatter.init();
|
BriefLogFormatter.init();
|
||||||
Utils.rollMockClock(0);
|
Utils.setMockClock();
|
||||||
group = new KeyChainGroup();
|
group = new KeyChainGroup();
|
||||||
group.setLookaheadSize(LOOKAHEAD_SIZE); // Don't want slow tests.
|
group.setLookaheadSize(LOOKAHEAD_SIZE); // Don't want slow tests.
|
||||||
group.getActiveKeyChain(); // Force create a chain.
|
group.getActiveKeyChain(); // Force create a chain.
|
||||||
|
Loading…
Reference in New Issue
Block a user