Skip to content

Commit

Permalink
extends TestStateSaveLoad to account for timeout equality
Browse files Browse the repository at this point in the history
  • Loading branch information
staheri14 committed Sep 25, 2024
1 parent 00d8e1c commit 3b6cbb3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ func TestStateSaveLoad(t *testing.T) {
})
assert := assert.New(t)

state.TimeoutCommit = 10 * time.Second
state.TimeoutPropose = 5 * time.Second
state.LastBlockHeight++
state.LastValidators = state.Validators
err := stateStore.Save(state)
Expand All @@ -159,6 +161,13 @@ func TestStateSaveLoad(t *testing.T) {
assert.True(state.Equals(loadedState),
fmt.Sprintf("expected state and its copy to be identical.\ngot: %v\nexpected: %v\n",
loadedState, state))

// the following assertions are just for additional assurance
assert.Equal(state.TimeoutCommit, loadedState.TimeoutCommit,
fmt.Sprintf("expected TimeoutCommit to be equal."+
"\ngot: %v\nexpected: %v\n", loadedState.TimeoutCommit, state.TimeoutCommit))
assert.Equal(state.TimeoutPropose, loadedState.TimeoutPropose, fmt.Sprintf("expected TimeoutPropose to be equal."+
"\ngot: %v\nexpected: %v\n", loadedState.TimeoutPropose, state.TimeoutPropose))
}

// TestABCIResponsesSaveLoad tests saving and loading ABCIResponses.
Expand Down

0 comments on commit 3b6cbb3

Please sign in to comment.