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

[Neo Plugins UT] Add RpcServer Unit Tests Part Blockchain. #3339

Merged
merged 24 commits into from
Jun 28, 2024

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Jun 16, 2024

Description

Neo Plugins lack unit tests, making it not clear whether our update to the code has changed any existing functionality or not. Thus having this pr to standard the plugin rpcserver method behavior.

Fixes # #3339

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • TestGetBestBlockHash
  • TestGetBlockByHash
  • TestGetBlockByIndex
  • TestGetBlockByUnknownIndex
  • TestGetBlockByUnknownHash
  • TestGetBlockByUnKnownIndex
  • TestGetBlockByUnKnownHash
  • TestGetBlockCount
  • TestGetBlockHeaderCount
  • TestGetBlockHash
  • TestGetBlockHashInvalidIndex
  • TestGetBlockHeader
  • TestGetContractState
  • TestGetContractStateUnknownContract
  • TestGetStorage
  • TestGetStorageUnknownContract
  • TestGetStorageUnknownStorageItem
  • TestFindStorage
  • TestFindStorageInvalidParams
  • TestGetRawMemPool
  • TestGetRawTransaction
  • TestGetRawTransactionUnknownTransaction
  • TestGetNextBlockValidators
  • TestGetCandidates
  • TestGetCommittee
  • TestGetNativeContracts
  • TestGetTransactionHeight
  • TestGetTransactionHeightUnknownTransaction
  • TestGetTransactionHeightInvalidParams
  • TestGetBestBlockHashInvalidParams
  • TestGetBlockInvalidParams
  • TestGetBlockHashInvalidParams
  • TestGetBlockHeaderInvalidParams
  • TestGetContractStateInvalidParams
  • TestGetStorageInvalidParams
  • TestGetRawTransactionInvalidParams
  • TestInternalServerError
  • TestUnknownHeight

Test Configuration:

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

Jim8y and others added 7 commits June 14, 2024 06:32
* master:
  Fixed pathing and Property (neo-project#3306)
  [Neo CLI New Feature] Allow custom plugins (neo-project#3295)
  Return expect to verify neo-cli (neo-project#3318)
  [Neo CLI Optimization] fix exception message (neo-project#3314)
  fix plugin download url (neo-project#3329)
@Jim8y Jim8y changed the title [Neo Plugins UT] Add RpcServer Unit Tests Part 1. [Neo Plugins UT] Add RpcServer Unit Tests Part Blockchain. Jun 16, 2024
@Jim8y
Copy link
Contributor Author

Jim8y commented Jun 16, 2024

How come the test coverage decreased 20%,,,, while i just aded tests in this pr.....

src/Plugins/RpcServer/RpcServer.Blockchain.cs Outdated Show resolved Hide resolved
src/Plugins/RpcServer/RpcServer.Blockchain.cs Outdated Show resolved Hide resolved
tests/Neo.Plugins.RpcServer.Tests/UT_RpcServer.cs Outdated Show resolved Hide resolved
tests/Neo.Plugins.RpcServer.Tests/UT_RpcServer.cs Outdated Show resolved Hide resolved
NGDAdmin
NGDAdmin previously approved these changes Jun 20, 2024
cschuchardt88
cschuchardt88 previously approved these changes Jun 20, 2024
shargon
shargon previously approved these changes Jun 20, 2024
Copy link
Member

@AnnaShaleva AnnaShaleva left a comment

Choose a reason for hiding this comment

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

A good set of tests.

src/Plugins/RpcServer/RpcServer.Blockchain.cs Outdated Show resolved Hide resolved
src/Plugins/RpcServer/RpcServer.Blockchain.cs Outdated Show resolved Hide resolved
src/Plugins/RpcServer/RpcServer.Blockchain.cs Outdated Show resolved Hide resolved
src/Plugins/RpcServer/RpcServer.Blockchain.cs Outdated Show resolved Hide resolved
/// An array containing the transaction hash as the first element,
/// and an optional boolean indicating whether to return verbose information.
/// </param>
/// <returns>The transaction data as a <see cref="JToken"/>. In json format if the second item of _params is true, otherwise base64string. </returns>
Copy link
Member

Choose a reason for hiding this comment

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

I see the base64string pattern being repeated, so it's probably intentionally.

src/Plugins/RpcServer/RpcServer.Blockchain.cs Outdated Show resolved Hide resolved
@Jim8y Jim8y dismissed stale reviews from cschuchardt88 and shargon via 67eddfa June 25, 2024 23:14
@NGDAdmin NGDAdmin merged commit 07fb5ce into neo-project:master Jun 28, 2024
6 of 7 checks passed
@Jim8y Jim8y deleted the mock-rpcserver-test branch July 19, 2024 01:38
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.

5 participants