Skip to content

[Neo Plugins UT] Fix namespace for adding plugin ut tests#3286

Merged
shargon merged 5 commits intoneo-project:masterfrom
Jim8y:fix-namespace-for-plugin-ut
Jun 1, 2024
Merged

[Neo Plugins UT] Fix namespace for adding plugin ut tests#3286
shargon merged 5 commits intoneo-project:masterfrom
Jim8y:fix-namespace-for-plugin-ut

Conversation

@Jim8y
Copy link
Contributor

@Jim8y Jim8y commented May 31, 2024

Description

The namespace in the neo plugin is very confusing and conflicts with the class name, so we need to sort out the namespace.

For Instance,

it is Neo.Plugins; for some plugin,
ApplicationLogs.Store; for some plugin,
Neo.Consensus for some plugin.

Now all change to Neo.Plugins.XXXX;

The issue that makes me have to make this change is the namespace of RpcServer is Neo.Plugins;, while it has a class of RpcServer, which is exactly the name of the plugin. If i want to add UT test for it, it conflics with the UT namespace as Neo.Plugins.RpcServer.Tests;, the namespace of the UT makes it impossible to get access to the RpcServer class.

Fixes # Closes #3287

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?

To demonstrate the change, i have added the UT moq that i will be using to test the rpcserver. More tests will be added in other prs.

  • TestCheckAuth_ValidCredentials_ReturnsTrue

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 changed the title [Neo Plugins UT] Fix namespace for plugin ut [Neo Plugins UT] Fix namespace for adding plugin ut tests May 31, 2024
@Jim8y Jim8y requested a review from a team May 31, 2024 02:50
@shargon
Copy link
Member

shargon commented May 31, 2024

@Jim8y any obsolete call that we can remove it? now that the public method will change it's a good time to clean it

@Jim8y
Copy link
Contributor Author

Jim8y commented May 31, 2024

@shargon do as you wish.

@Jim8y Jim8y requested a review from a team June 1, 2024 01:17
@shargon shargon merged commit 68d4005 into neo-project:master Jun 1, 2024
@Jim8y Jim8y deleted the fix-namespace-for-plugin-ut branch June 3, 2024 01:42
<ItemGroup>
<InternalsVisibleTo Include="Neo.SmartContract.Testing" />
<InternalsVisibleTo Include="Neo.SmartContract.TestEngine" />
<InternalsVisibleTo Include="Neo.Plugins.RpcServer.Tests" />
Copy link
Member

Choose a reason for hiding this comment

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

@Jim8y

Why just RpcServer here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding ut for these plugin will be a very huge task, now i can only focus on rpcserver. whoever want to work on other plugin can add by urself.

Copy link
Member

Choose a reason for hiding this comment

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

I mean, why not include [Neo.Plugins.OracleService.Tests](https://github.com/neo-project/neo/tree/master/tests/Neo.Plugins.OracleService.Tests) and Neo.Plugins.Storage.Tests

What was this need?

}

RpcServer server = new(system, s);
RpcServer rpcRpcServer = new(system, s);
Copy link
Member

Choose a reason for hiding this comment

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

mainRpcServer?

Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

The changes looks good. You could had wait more for merging. There are changes on the organization of files and classes, in particular, consensus.

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.

[Neo Plugins] Fix the Neo Plugins Namespace

4 participants