From 731103a448f291994d9c20e2b0c40d4446f5e8f9 Mon Sep 17 00:00:00 2001 From: r4f43l Date: Tue, 19 Dec 2023 14:05:59 +0100 Subject: [PATCH] Refactor mock leader in nonce cache tests --- signer/cosigner_nonce_cache_test.go | 8 ++++---- signer/threshold_validator_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/signer/cosigner_nonce_cache_test.go b/signer/cosigner_nonce_cache_test.go index e9974f66..9091d84c 100644 --- a/signer/cosigner_nonce_cache_test.go +++ b/signer/cosigner_nonce_cache_test.go @@ -153,7 +153,7 @@ func TestNonceCacheDemand(t *testing.T) { nonceCache := NewCosignerNonceCache( cometlog.NewTMLogger(cometlog.NewSyncWriter(os.Stdout)), cosigners, - &MockLeader{id: 1, leader: &ThresholdValidator{myCosigner: lcs[0]}}, + &MockLeader{id: 1, leader: &MockThresholdValidator{myCosigner: lcs[0]}}, 500*time.Millisecond, 100*time.Millisecond, defaultNonceExpiration, @@ -205,7 +205,7 @@ func TestNonceCacheExpiration(t *testing.T) { nonceCache := NewCosignerNonceCache( cometlog.NewTMLogger(cometlog.NewSyncWriter(os.Stdout)), cosigners, - &MockLeader{id: 1, leader: &ThresholdValidator{myCosigner: lcs[0]}}, + &MockLeader{id: 1, leader: &MockThresholdValidator{myCosigner: lcs[0]}}, getNoncesInterval, getNoncesTimeout, noncesExpiration, @@ -411,7 +411,7 @@ func TestNonceCacheDemandSlow(t *testing.T) { nonceCache := NewCosignerNonceCache( cometlog.NewTMLogger(cometlog.NewSyncWriter(os.Stdout)), cosigners, - &MockLeader{id: 1, leader: &ThresholdValidator{myCosigner: lcs[0]}}, + &MockLeader{id: 1, leader: &MockThresholdValidator{myCosigner: lcs[0]}}, 90*time.Millisecond, 100*time.Millisecond, 500*time.Millisecond, @@ -448,7 +448,7 @@ func TestNonceCacheDemandSlowDefault(t *testing.T) { nonceCache := NewCosignerNonceCache( cometlog.NewTMLogger(cometlog.NewSyncWriter(os.Stdout)), cosigners, - &MockLeader{id: 1, leader: &ThresholdValidator{myCosigner: lcs[0]}}, + &MockLeader{id: 1, leader: &MockThresholdValidator{myCosigner: lcs[0]}}, defaultGetNoncesInterval, defaultGetNoncesTimeout, defaultNonceExpiration, diff --git a/signer/threshold_validator_test.go b/signer/threshold_validator_test.go index 762aa9d2..5828175b 100644 --- a/signer/threshold_validator_test.go +++ b/signer/threshold_validator_test.go @@ -1,4 +1,4 @@ -package signer_test +package signer import ( "bytes"