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
Coverage for: api/gin + addressGroup #5175
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## rc/v1.6.0 #5175 +/- ##
=============================================
+ Coverage 78.47% 78.75% +0.27%
=============================================
Files 680 680
Lines 88162 88133 -29
=============================================
+ Hits 69187 69406 +219
+ Misses 13740 13502 -238
+ Partials 5235 5225 -10
☔ View full report in Codecov by Sentry. |
api/errors/errors.go
Outdated
var ErrGetESDTTokensWithRole = errors.New("getting esdt tokens with role error") | ||
|
||
// ErrNFTTokenIDsRegistered signals an error in getting the nft token ids registered by the given address | ||
var ErrNFTTokenIDsRegistered = errors.New("getting nft token ids registered error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registered token ids
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed
The base branch was changed.
…into api_tests
api/gin/common.go
Outdated
@@ -40,7 +40,7 @@ func checkArgs(args ArgsNewWebServer) error { | |||
} | |||
|
|||
if check.IfNil(args.Facade) { | |||
return errHandler("nil facade") | |||
return errHandler(apiErrors.ErrNilFacadeHandler.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove the err handler usage and have this as:
if check.IfNil(args.Facade) {
return fmt.Errorf("%w: %s", apiErrors.ErrCannotCreateGinWebServer, apiErrors.ErrNilFacadeHandler.Error())
}
api/groups/addressGroup.go
Outdated
@@ -424,30 +424,30 @@ func (ag *addressGroup) getESDTsRoles(c *gin.Context) { | |||
func (ag *addressGroup) getESDTTokensWithRole(c *gin.Context) { | |||
addr := c.Param("address") | |||
if addr == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can have L427 - L446 extracted in a function. If that function errors, we can treat only once the returned error by calling shared.RespondWithValidationError
api/groups/addressGroup.go
Outdated
@@ -458,19 +458,19 @@ func (ag *addressGroup) getESDTTokensWithRole(c *gin.Context) { | |||
func (ag *addressGroup) getNFTTokenIDsRegisteredByAddress(c *gin.Context) { | |||
addr := c.Param("address") | |||
if addr == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here, L460-L475 can be a new function so the error handling is done once
require.Equal(t, api.AccountQueryOptions{}, options) | ||
|
||
options, err = parseAccountQueryOptions(testscommon.CreateGinContextWithRawQuery("onStartOfEpoch=test")) | ||
require.Error(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to test the errors? At least at string level.
api/groups/addressGroup_test.go
Outdated
|
||
emptyAddress := "" | ||
addrGroup, err := groups.NewAddressGroup(&facade) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we reuse L293-L304? I think we can have a common function out of this and also reused on L232 and other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System test passed.
@@ Log scanner @@
api_tests
================================================================================
- Known Warnings 9
- New Warnings 1
- Known Errors 0
- New Errors 3
- Panics 0
================================================================================ - block hash does not match 13847
- wrong nonce in block 5298
- miniblocks does not match 0
- num miniblocks does not match 0
- miniblock hash does not match 0
- block bodies does not match 0
- receipts hash missmatch 0
================================================================================ - No jailed nodes on the testnet
================================================================================
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?