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 Plugin UT] Rpcserver unit test on node #3353

Merged
merged 33 commits into from
Jul 11, 2024

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Jun 24, 2024

Description

This is the second pr that focus on adding unit tests for rpcservers.

Fixes # #3350

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?

Here is the list of method names extracted from the provided code:

  1. TestGetVersion
  2. TestSendRawTransaction_Normal
  3. TestSendRawTransaction_InvalidTransactionFormat
  4. TestSendRawTransaction_InsufficientBalance
  5. TestSendRawTransaction_InvalidSignature
  6. TestSendRawTransaction_InvalidScript
  7. TestSendRawTransaction_InvalidAttribute
  8. TestSendRawTransaction_Oversized
  9. TestSendRawTransaction_Expired
  10. TestSendRawTransaction_PolicyFailed
  11. TestSendRawTransaction_AlreadyInPool
  12. TestSendRawTransaction_AlreadyInBlockchain
  13. TestSendRawTransaction_MemoryPoolFull
  14. TestSubmitBlock_Normal
  15. TestSubmitBlock_InvalidBlockFormat
  16. TestSubmitBlock_AlreadyExists
  17. TestSubmitBlock_InvalidBlock
  18. TestSendRawTransaction_NullInput
  19. TestSendRawTransaction_EmptyInput
  20. TestSubmitBlock_NullInput
  21. TestSubmitBlock_EmptyInput

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 Jim8y marked this pull request as draft June 24, 2024 00:17
@Jim8y Jim8y requested review from cschuchardt88, shargon and AnnaShaleva and removed request for cschuchardt88 and shargon June 26, 2024 08:39
@Jim8y Jim8y marked this pull request as ready for review June 26, 2024 08:40
@Jim8y Jim8y requested review from shargon and vncoelho June 26, 2024 08:44
@vncoelho
Copy link
Member

Coverage is not working and some verification are failing, Jimmy.

@Jim8y
Copy link
Contributor Author

Jim8y commented Jun 26, 2024

Coverage is not working and some verification are failing, Jimmy.

i.know, i will fix that, i changed testing utils and that caused some test fail

@vncoelho
Copy link
Member

Coverage is not working and some verification are failing, Jimmy.

i.know, i will fix that, i changed testing utils and that caused some test fail

Sure, as soon as fixed I will review here again.

I just verified something related to Debug for the method clear of mempool.
What is the real use of this on the UTs themself?

@Jim8y Jim8y removed the need update label Jul 5, 2024
@Jim8y
Copy link
Contributor Author

Jim8y commented Jul 5, 2024

@Jim8y
Copy link
Contributor Author

Jim8y commented Jul 5, 2024

Have to update some existing tests cause i updated the timestamp of the test block since it was the same as genesis block.

cschuchardt88
cschuchardt88 previously approved these changes Jul 5, 2024
Comment on lines +663 to +666
#if DEBUG
// This method is only for test purpose
// Do not remove it from the DEBUG build
internal void Clear()
Copy link
Member

@shargon shargon Jul 5, 2024

Choose a reason for hiding this comment

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

I think it doesn't hurt without debug, it's already internal, but it's ok for me

Copy link
Member

Choose a reason for hiding this comment

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

If we compile in release maybe it fault because the UT require this method

Copy link
Member

@cschuchardt88 cschuchardt88 Jul 8, 2024

Choose a reason for hiding this comment

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

Then add to test the same way as #if DEBUG

Copy link
Member

Choose a reason for hiding this comment

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

@Jim8y we need to compile the whole sln in release, I think it won't work with this change

@Jim8y
Copy link
Contributor Author

Jim8y commented Jul 6, 2024

@superboyiii

@NGDAdmin NGDAdmin merged commit 3351533 into neo-project:master Jul 11, 2024
7 checks passed
@shargon shargon mentioned this pull request Jul 11, 2024
Jim8y added a commit to Jim8y/neo that referenced this pull request Jul 12, 2024
* master:
  Fixed Publish Step (neo-project#3411)
  Fix release compilation (neo-project#3417)
  [Neo Plugin UT] Rpcserver unit test on node (neo-project#3353)
  Improve code coverage (neo-project#3354)
  `[Add]` Debug Output to `Expect` (neo-project#3407)
  [Neo Plugin Store] Unit test (neo-project#3399)
  Bump System.Text.Json from 8.0.3 to 8.0.4 in /src/Neo.Json (neo-project#3416)

# Conflicts:
#	tests/Neo.Plugins.RpcServer.Tests/TestBlockchain.cs
#	tests/Neo.UnitTests/Network/P2P/Payloads/UT_Header.cs
Jim8y added a commit to Jim8y/neo that referenced this pull request Jul 18, 2024
* master: (27 commits)
  Revert "Plugin unhandled exception (neo-project#3349)" (neo-project#3366)
  `[Move]` Part-2 Classes into Different Library - `Neo.IO` (neo-project#3388)
  [Neo Core Store] Rename various snapshots. (neo-project#3406)
  [Neo Core Storage] Implicit methods and tests (neo-project#3403)
  [Neo Core MemoryStore] MemoryStore Unit Tests. (neo-project#3404)
  Fixed Publish Step (neo-project#3411)
  Fix release compilation (neo-project#3417)
  [Neo Plugin UT] Rpcserver unit test on node (neo-project#3353)
  Improve code coverage (neo-project#3354)
  `[Add]` Debug Output to `Expect` (neo-project#3407)
  [Neo Plugin Store] Unit test (neo-project#3399)
  Bump System.Text.Json from 8.0.3 to 8.0.4 in /src/Neo.Json (neo-project#3416)
  `[Typo]` Unit Tests - UT_ProtocolSettings.CreateHKSettings (neo-project#3383)
  `[Fix]` Test Problems (neo-project#3398)
  Part-1 `Neo.IO` - move (neo-project#3387)
  Fixed Props Pathing for `dotnet pack` with `nuget` (neo-project#3379)
  `[neo-cli]` Error Message and Warning - LevelDb (neo-project#3380)
  Fix crash when comparing ContractPermissionDescriptor (neo-project#3396)
  `DeprecatedIn` for events (neo-project#3362)
  Fix download tips (neo-project#3395)
  ...
@Jim8y Jim8y deleted the rpcserver_test_node branch July 19, 2024 01:37
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