Skip to content

Commit

Permalink
Fix proposervm.GetAncestors test flake (ava-labs#1572)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Jun 2, 2023
1 parent 842a6ab commit c2ff5ff
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 125 deletions.
12 changes: 6 additions & 6 deletions vms/platformvm/blocks/executor/proposal_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ func TestApricotProposalBlockTimeVerification(t *testing.T) {
onParentAccept.EXPECT().GetDelegateeReward(constants.PrimaryNetworkID, utx.NodeID()).Return(uint64(0), nil).AnyTimes()

env.mockedState.EXPECT().GetUptime(gomock.Any(), constants.PrimaryNetworkID).Return(
time.Duration(1000), /*upDuration*/
time.Time{}, /*lastUpdated*/
nil, /*err*/
time.Microsecond, /*upDuration*/
time.Time{}, /*lastUpdated*/
nil, /*err*/
).AnyTimes()

// wrong height
Expand Down Expand Up @@ -240,9 +240,9 @@ func TestBanffProposalBlockTimeVerification(t *testing.T) {
onParentAccept.EXPECT().GetPendingStakerIterator().Return(pendingStakersIt, nil).AnyTimes()

env.mockedState.EXPECT().GetUptime(gomock.Any(), gomock.Any()).Return(
time.Duration(1000), /*upDuration*/
time.Time{}, /*lastUpdated*/
nil, /*err*/
time.Microsecond, /*upDuration*/
time.Time{}, /*lastUpdated*/
nil, /*err*/
).AnyTimes()

// create proposal tx to be included in the proposal block
Expand Down
4 changes: 2 additions & 2 deletions vms/platformvm/state/validator_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func TestParseValidatorMetadata(t *testing.T) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x86, 0xA0,
},
expected: &validatorMetadata{
UpDuration: time.Duration(6000000),
UpDuration: 6000000,
LastUpdated: 900000,
PotentialReward: 100000,
lastUpdated: time.Unix(900000, 0),
Expand All @@ -240,7 +240,7 @@ func TestParseValidatorMetadata(t *testing.T) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x20,
},
expected: &validatorMetadata{
UpDuration: time.Duration(6000000),
UpDuration: 6000000,
LastUpdated: 900000,
PotentialReward: 100000,
PotentialDelegateeReward: 20000,
Expand Down
8 changes: 4 additions & 4 deletions vms/platformvm/txs/executor/staker_tx_verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,8 @@ func TestGetValidatorRules(t *testing.T) {
assetID: customAssetID,
minValidatorStake: config.MinValidatorStake,
maxValidatorStake: config.MaxValidatorStake,
minStakeDuration: time.Duration(1337) * time.Second,
maxStakeDuration: time.Duration(42) * time.Second,
minStakeDuration: 1337 * time.Second,
maxStakeDuration: 42 * time.Second,
minDelegationFee: config.MinDelegationFee,
},
expectedErr: nil,
Expand Down Expand Up @@ -760,8 +760,8 @@ func TestGetDelegatorRules(t *testing.T) {
assetID: customAssetID,
minDelegatorStake: config.MinDelegatorStake,
maxValidatorStake: config.MaxValidatorStake,
minStakeDuration: time.Duration(1337) * time.Second,
maxStakeDuration: time.Duration(42) * time.Second,
minStakeDuration: 1337 * time.Second,
maxStakeDuration: 42 * time.Second,
maxValidatorWeightFactor: 21,
},
expectedErr: nil,
Expand Down
Loading

0 comments on commit c2ff5ff

Please sign in to comment.