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

[ioctl] Build block bucket command line into new ioctl #3386

Merged
merged 31 commits into from
Jun 20, 2022

Conversation

LuckyPigeon
Copy link
Contributor

@LuckyPigeon LuckyPigeon commented May 12, 2022

Description

Build bcbucket command in new ioctl, with the following note.

  • Use client interface to construct the Cobra command.
  • Output package is deprecated, replace it with errors package.
  • Replace fmt.Println with cmd.Println
  • Global variables (config.ReadConfig config.DefaultConfigFile etc.) have been wrapped into client interface. Please use client interface to access them if needed
  • Refactor unit test to cover the modification.
  • Check results in each unit test.

Fixes #3265

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code refactor or improvement

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] TestNewBCBucketCmd

Test Configuration:

  • Firmware version: Ubuntu 21.04
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Merging #3386 (5ff4c65) into master (61d189f) will increase coverage by 0.07%.
The diff coverage is 89.47%.

@@            Coverage Diff             @@
##           master    #3386      +/-   ##
==========================================
+ Coverage   75.22%   75.29%   +0.07%     
==========================================
  Files         238      239       +1     
  Lines       22057    22171     +114     
==========================================
+ Hits        16592    16694     +102     
- Misses       4574     4581       +7     
- Partials      891      896       +5     
Impacted Files Coverage Δ
ioctl/newcmd/bc/bcbucket.go 89.47% <89.47%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61d189f...5ff4c65. Read the comment docs.

@LuckyPigeon
Copy link
Contributor Author

@huof6829
How can I test bcbucket.go if I don't have relative node for tcp dial connection. Code show as follow,

conn, err := util.ConnectToEndpoint(config.ReadConfig.SecureConnect && !config.Insecure)

@huof6829
Copy link
Contributor

@huof6829 How can I test bcbucket.go if I don't have relative node for tcp dial connection. Code show as follow,

conn, err := util.ConnectToEndpoint(config.ReadConfig.SecureConnect && !config.Insecure)

use client.APIServiceClient, then use gomock function in test function. See

apiServiceClient, err := client.APIServiceClient(ioctl.APIServiceConfig{

ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
@xianhuawei xianhuawei marked this pull request as ready for review May 23, 2022 10:57
@xianhuawei xianhuawei requested a review from a team as a code owner May 23, 2022 10:57
@LuckyPigeon
Copy link
Contributor Author

@xianhuawei
This PR hasn't completed yet, still working on unit test.

@LuckyPigeon LuckyPigeon requested a review from huof6829 May 27, 2022 19:46
ioctl/newcmd/bc/bcbucket_test.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket_test.go Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket_test.go Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
ioctl/newcmd/bc/bcbucket.go Outdated Show resolved Hide resolved
@Liuhaai
Copy link
Member

Liuhaai commented Jun 17, 2022

@LuckyPigeon the test fails. Could you help fix it? The pr is ready to be merged.

@LuckyPigeon
Copy link
Contributor Author

@Liuhaai Done!

@huof6829 huof6829 merged commit 9c24171 into iotexproject:master Jun 20, 2022
pocockn added a commit to pocockn/iotex-core that referenced this pull request Jul 4, 2022
* upstream/master: (24 commits)
  account type with zero init nonce (iotexproject#3387)
  [api] Separate Server and Server Handler (iotexproject#3485)
  [ioctl] Build hdwallet derive command line into new ioctl (iotexproject#3418)
  [ioctl] Build hdwallet create command line into new ioctl (iotexproject#3470)
  [makefile] add go mod tidy (iotexproject#3471)
  [api] update chain metrics (iotexproject#3484)
  remove config.EVMNetworkID() (iotexproject#3460)
  [filedao] remove checkMasterChainDBFile() (iotexproject#3463)
  [api] add crashlog (iotexproject#3456)
  [api] Move generateBlockMeta to grpcserver.go (iotexproject#3303)
  [ioctl] Build action hash command line into new ioctl (iotexproject#3425)
  [ioctl] Build hdwallet export command line into new ioctl (iotexproject#3423)
  [ioctl] Refactor nodereward command in new ioctl (iotexproject#3416)
  [ioctl] Cleanup TestNewNodeDelegateCmd (iotexproject#3421)
  [blockchain] Remove BoltDBDaoOption (iotexproject#3465)
  remove InMemDaoOption (iotexproject#3464)
  [action] add evm london test (iotexproject#3402)
  [ioctl] create main for ioctl/newcmd (iotexproject#3296)
  [ioctl] Build block bucket command line into new ioctl (iotexproject#3386)
  [ioctl] Build hdwallet import command line into new ioctl (iotexproject#3419)
  ...
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.

[ioctl] build block bucket command line into new ioctl
3 participants