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

test: cli: adding wallet tests #8079

Merged
merged 7 commits into from
Mar 2, 2022
Merged

test: cli: adding wallet tests #8079

merged 7 commits into from
Mar 2, 2022

Conversation

TheMenko
Copy link
Contributor

Related Issues

This PR is related to #8048.
The chain cli test branch have been merged into this PR, so #8048 should be merged first.

Proposed Changes

This PR adds wallet tests for CLI.
Most of the wallet cli commands have been tested.
It uses the mocked API from chain cli test branch.

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • All commits have a clear commit message.
  • The PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, test
    • area: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps
  • This PR has tests for new functionality or change in behaviour
  • If new user-facing features are introduced, clear usage guidelines and / or documentation updates should be included in https://lotus.filecoin.io or Discussion Tutorials.
  • CI is green

@TheMenko TheMenko self-assigned this Feb 11, 2022
@TheDivic
Copy link
Contributor

TheDivic commented Feb 13, 2022

@TheMenko You should check for output of cli commands, but don't be to specific, don't do exact string matching but look for some important substrings. For example if a CLI command outputs a bunch of text but somewhere in that text you expect to see a specific address, look for that address using assert.Contains(t, out, address.String()), you don't care about the rest.
And it would be really awesome if you added a test for wallet import (with file mocking that we discussed previously).

@TheMenko TheMenko marked this pull request as ready for review February 22, 2022 15:00
@TheMenko TheMenko requested a review from a team as a code owner February 22, 2022 15:00
@TheMenko TheMenko requested review from a team and removed request for a team February 22, 2022 15:00
Comment on lines 74 to 75
err := app.Run([]string{"wallet", "list", "addr-only"})
assert.NoError(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should do some asserts on the output here

cli/wallet_test.go Show resolved Hide resolved
@magik6k magik6k merged commit c018dac into master Mar 2, 2022
@magik6k magik6k deleted the cli_wallet_tests branch March 2, 2022 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants