8000 test(service/network): introduce unit testing tooling by ivanovpetr · Pull Request #2235 · ignite/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

test(service/network): introduce unit testing tooling #2235

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

Merged
merged 20 commits into from
Apr 19, 2022

Conversation

ivanovpetr
Copy link
Contributor
@ivanovpetr ivanovpetr commented Mar 30, 2022

This PR introduces test utils for testing network package. The main novations are.

  • Mocks generated with vektra/mockery package
  • Utility functions to generate stubs for test purposes (Account and TxResponse)

As an example of application of these tools I introduce tests for launch function of network package. Would like to hear as much feedback as possible prior writing other tests.

@cloudflare-workers-and-pages
Copy link
cloudflare-workers-and-pages bot commented Apr 6, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: a468abd
Status: ✅  Deploy successful!
Preview URL: https://1aa67719.ignite-docs.pages.dev

View logs

@ilgooz
Copy link
Member
ilgooz commented Apr 11, 2022

Hey @ivanovpetr, what's the status on this, is it ready for reviews? (we merged cosmosaccount change recently.

@ilgooz
Copy link
Member
ilgooz commented Apr 13, 2022

Let's also resolve the conflicts. 👍

Petr Ivanov added 2 commits April 14, 2022 19:10
Conflicts:
	ignite/cmd/network.go
	ignite/pkg/cosmosclient/cosmosclient.go
	ignite/services/network/campaign.go
	ignite/services/network/join.go
	ignite/services/network/join_test.go
	ignite/services/network/launch.go
	ignite/services/network/launch_test.go
	ignite/services/network/mocks/account_info.go
	ignite/services/network/mocks/campaign_client.go
	ignite/services/network/mocks/chain.go
	ignite/services/network/mocks/cosmos_client.go
	ignite/services/network/mocks/launch_client.go
	ignite/services/network/mocks/profile_client.go
	ignite/services/network/mocks/reward_client.go
	ignite/services/network/network.go
	ignite/services/network/publish.go
	ignite/services/network/publish_test.go
	ignite/services/network/queries.go
	ignite/services/network/request.go
	ignite/services/network/testutil/account.go
	ignite/services/network/testutil/chain.go
	ignite/services/network/testutil/genesis.go
	ignite/services/network/testutil/gentx.go
	ignite/services/network/testutil/mocks.go
	ignite/services/network/testutil/response.go
	ignite/services/network/testutil/suite.go
@ivanovpetr
Copy link
Contributor Author
ivanovpetr commented Apr 14, 2022

Enhancements to do in this PR

  • require.NoNil to require.NoError, for errors.
  • Use var() for multiple variables
  • create a NewSuite func in network/testutil.NewSuite, instead of funcs like stubNetworkFor(Join/Publish/Launch)
  • use network.New in testing, provide query services with options so they can be overwritten in tests
  • depreceate AssertCalled, depreacete chainmock package, mock the networkchain funcs directly in the tests. for simplcity
  • instead of emptyContext , use context.Background()

@ivanovpetr ivanovpetr requested a review from ilgooz April 14, 2022 19:04
@ilgooz
Copy link
Member
ilgooz commented Apr 15, 2022

Looks very good!

@ivanovpetr ivanovpetr marked this pull request as ready for review April 15, 2022 17:28
Copy link
Member
@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 - cannot wait us to merge this!

@ilgooz ilgooz changed the title test(service/network): implement unit testing tooling for the network package test(service/network): introduce unit testing tooling Apr 19, 2022
@ivanovpetr ivanovpetr requested a review from ilgooz April 19, 2022 14:17
Copy link
Member
@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍻

@ilgooz ilgooz merged commit aa2aa87 into develop Apr 19, 2022
@ilgooz ilgooz deleted the feat/network-pkg-testing branch April 19, 2022 19:01
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
* implement unit testing tooling for the network package

* implement unit testing tooling for the network package

* tests for Publish function

* tests for Join function

* refactor test accounts

* revert accidental testada rename

* refactor tests

* rename starport to ignite

* add tests fo SetReward

* add tests fo RevertLaunch

* add review fixes

* add review fixes

* simplify Network constructor

Co-authored-by: Petr Ivanov <petr.ivanov@tendermint.com>
Co-authored-by: İlker G. Öztürk <ilkergoktugozturk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0