-
Notifications
You must be signed in to change notification settings - Fork 558
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
feat: add test suite for the cli tests #3715
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
68af5e2
add suite extension for the cli tests
4892f8b
fix test lock for network
78d8571
Merge branch 'main' into feat/cli-test-suite
Pantani f721944
fix missing vars in template
b7ca7c1
add a flag to check if the network mutex is locked
e913070
reset the config for each test in the cli pkg
ae4e174
fix test suite parameter for CLI test
b001a77
wait for the next block to execute the tests
8495842
update changelog
f8468c7
Merge branch 'main' into feat/cli-test-suite
Pantani 2f731f9
Merge branch 'main' into feat/cli-test-suite
Pantani 2a8a11e
Merge branch 'main' into feat/cli-test-suite
Pantani 8145b6c
Merge branch 'main' into feat/cli-test-suite
Pantani 703fdb1
Merge branch 'main' into feat/cli-test-suite
jeronimoalbi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/suite_test.go.plush
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package cli_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
|
||
"<%= modulePath %>/testutil/network" | ||
) | ||
|
||
type IntegrationTestSuite struct { | ||
suite.Suite | ||
|
||
locked bool | ||
net *network.Network | ||
cfg network.Config | ||
} | ||
|
||
func (s *IntegrationTestSuite) network() *network.Network { | ||
s.net = network.New(s.T(), s.cfg) | ||
s.locked = true | ||
return s.net | ||
} | ||
|
||
func (s *IntegrationTestSuite) waitForNextBlock() { | ||
s.T().Log("wait for next block") | ||
s.Require().NoError(s.net.WaitForNextBlock()) | ||
} | ||
|
||
func (s *IntegrationTestSuite) SetupTest() { | ||
s.T().Log("setting up test") | ||
s.cfg = network.DefaultConfig() | ||
} | ||
|
||
func (s *IntegrationTestSuite) SetupSuite() { | ||
s.T().Log("setting up integration test suite") | ||
s.cfg = network.DefaultConfig() | ||
} | ||
|
||
func (s *IntegrationTestSuite) TearDownTest() { | ||
s.T().Log("tearing down test") | ||
if s.net != nil && s.locked { | ||
s.net.Cleanup() | ||
s.locked = false | ||
} | ||
} | ||
|
||
func (s *IntegrationTestSuite) TearDownSuite() { | ||
s.T().Log("tearing down integration test suite") | ||
} | ||
|
||
func TestIntegrationTestSuite(t *testing.T) { | ||
suite.Run(t, new(IntegrationTestSuite)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure but wouldn't it make sense to set the config per test and remove the config initialization from the suite?
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.
We are setting the config per test, but since we have a global config we are resetting the config for each test