-
Notifications
You must be signed in to change notification settings - Fork 180
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
[Access] Make response for data providers consistent. #6846
Open
AndriiDiachuk
wants to merge
8
commits into
onflow:master
Choose a base branch
from
The-K-R-O-K:AndriiDiachuk/6819-make-response-for-data-providers-consistent
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
275b16e
Changed response to consostent for block provider
AndriiDiachuk 738ad8b
Merge branch 'AndriiDiachuk/6586-tx-statuses-data-providers-impl' of …
AndriiDiachuk 9d2a761
Changed responses to be consistant for all block data providers
AndriiDiachuk aafcc4d
Refactored response type of account statuses data provider
AndriiDiachuk 453f8d7
Refactored respone type of events daya provider
AndriiDiachuk 92016be
Refactored transaction statuses data providers
AndriiDiachuk 4c906b0
Merge branch 'master' of github.com:The-K-R-O-K/flow-go into AndriiDi…
AndriiDiachuk 4c3e5ae
Renamed fields naming
AndriiDiachuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,14 +146,17 @@ func (s *AccountStatusesProviderSuite) requireAccountStatuses( | |
expectedAccountStatusesResponse, ok := expectedResponse.(backend.AccountStatusesResponse) | ||
require.True(s.T(), ok, "unexpected type: %T", expectedResponse) | ||
|
||
actualResponse, ok := v.(*models.AccountStatusesResponse) | ||
require.True(s.T(), ok, "Expected *models.AccountStatusesResponse, got %T", v) | ||
actualResponse, ok := v.(*models.BaseDataProvidersResponse) | ||
require.True(s.T(), ok, "Expected *models.BaseDataProvidersResponse, got %T", v) | ||
|
||
require.Equal(s.T(), expectedAccountStatusesResponse.BlockID.String(), actualResponse.BlockID) | ||
require.Equal(s.T(), len(expectedAccountStatusesResponse.AccountEvents), len(actualResponse.AccountEvents)) | ||
actualResponseData, ok := actualResponse.Payload.(*models.AccountStatusesResponse) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I think we should also check the |
||
require.True(s.T(), ok, "unexpected response data type: %T", v) | ||
|
||
require.Equal(s.T(), expectedAccountStatusesResponse.BlockID.String(), actualResponseData.BlockID) | ||
require.Equal(s.T(), len(expectedAccountStatusesResponse.AccountEvents), len(actualResponseData.AccountEvents)) | ||
|
||
for key, expectedEvents := range expectedAccountStatusesResponse.AccountEvents { | ||
actualEvents, ok := actualResponse.AccountEvents[key] | ||
actualEvents, ok := actualResponseData.AccountEvents[key] | ||
require.True(s.T(), ok, "Missing key in actual AccountEvents: %s", key) | ||
|
||
s.Require().Equal(expectedEvents, actualEvents, "Mismatch for key: %s", key) | ||
|
@@ -252,9 +255,13 @@ func (s *AccountStatusesProviderSuite) TestMessageIndexAccountStatusesProviderRe | |
var responses []*models.AccountStatusesResponse | ||
for i := 0; i < accountStatusesCount; i++ { | ||
res := <-send | ||
accountStatusesRes, ok := res.(*models.AccountStatusesResponse) | ||
accountStatusesRes, ok := res.(*models.BaseDataProvidersResponse) | ||
s.Require().True(ok, "Expected *models.BaseDataProvidersResponse, got %T", res) | ||
|
||
accountStatusesResData, ok := accountStatusesRes.Payload.(*models.AccountStatusesResponse) | ||
s.Require().True(ok, "Expected *models.AccountStatusesResponse, got %T", res) | ||
responses = append(responses, accountStatusesRes) | ||
|
||
responses = append(responses, accountStatusesResData) | ||
} | ||
|
||
// Verifying that indices are starting from 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How about adding a common function or method
Build
forBaseDataProvidersResponse
that creates/fillsBaseDataProvidersResponse
and is used by every provider? Also I guess, we can usebaseDataProvider
as an argument to fillSubscriptionID
andTopic
. This approach would help avoid code duplication in the providers. What do you think?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.
This PR should be merged after #6802 and use
response.Build
functionality forPayload
field