Skip to content
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

MsgTriggerLaunch and MsgRevertLaunch tests: allow custom block timestamp and height for testing #582

Open
lumtis opened this issue Mar 2, 2022 · 0 comments
Labels
launch Related to launch module test Improve tests

Comments

@lumtis
Copy link
Contributor

lumtis commented Mar 2, 2022

MsgTriggerLaunch and MsgRevertLaunch contain logic that depends on the context of the block (height and timestamp) (height since #581)

We currently set constant value for the context for testing in keeper test package:

var (
	// ExampleTimestamp is a timestamp used as the current time for the context of the keepers returned from the package
	ExampleTimestamp = time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC)

	// ExampleHeight is a block height used as the current block height for the context of test keeper
	ExampleHeight = int64(1111)
)

For more reliable test we should allow to customize this value in the test case of the Table Tests, like for MsgTriggerLaunch for example:

for _, tc := range []struct {
  name string
  msg  types.MsgTriggerLaunch
  blockHeight int64
  blockTimestamp int64
  err  error
}{

With the current design of our tests, this change is actually not trivial and would require to work on #556

@lumtis lumtis added test Improve tests launch Related to launch module labels Mar 2, 2022
@lumtis lumtis added this to the Test Refactoring milestone May 26, 2022
@lumtis lumtis removed this from the Test Refactoring milestone Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launch Related to launch module test Improve tests
Projects
None yet
Development

No branches or pull requests

1 participant