-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor state tests to always use initialized state #3310
Conversation
test.checkStakerInState(require, rebuiltState, staker) | ||
test.checkValidatorsSet(require, rebuiltState, staker) | ||
test.checkValidatorUptimes(require, rebuiltState, staker) | ||
test.checkDiffs(require, rebuiltState, staker, 0 /*height*/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were checking the wrong state
😞.
@@ -675,7 +674,8 @@ func TestPersistStakers(t *testing.T) { | |||
t.Run(fmt.Sprintf("%s - subnetID %s", name, subnetID), func(t *testing.T) { | |||
require := require.New(t) | |||
|
|||
state, db := newUninitializedState(require) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using an uninitialized state here was super jank imo
}) | ||
} | ||
} | ||
} | ||
|
||
func newInitializedState(require *require.Assertions) State { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oddly enough, this wouldn't call load
previously... so the initialization flow wasn't as expected for a normal initialization.
Why this should be merged
Previously some tests relied on using an uninitialized testing struct.
How this works
genesistest
package so that constructing a simpleState
instance is easier for external packages.How this was tested