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

[Access] Make response for data providers consistent. #6846

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

AndriiDiachuk
Copy link
Contributor

Closes: #6819

@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.13%. Comparing base (b740fc0) to head (6c5aa7f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6846      +/-   ##
==========================================
+ Coverage   41.11%   41.13%   +0.01%     
==========================================
  Files        2116     2117       +1     
  Lines      185749   185778      +29     
==========================================
+ Hits        76378    76418      +40     
+ Misses     102954   102947       -7     
+ Partials     6417     6413       -4     
Flag Coverage Δ
unittests 41.13% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Guitarheroua Guitarheroua left a comment

Choose a reason for hiding this comment

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

I do not have any other comments. Looks good!

@peterargue peterargue requested a review from a team as a code owner January 13, 2025 22:06
@tarakby tarakby removed their request for review January 13, 2025 22:07
…achuk/6819-make-response-for-data-providers-consistent
…sistent' of github.com:The-K-R-O-K/flow-go into AndriiDiachuk/6819-make-response-for-data-providers-consistent
Copy link
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

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

added a couple small comments, but otherwise looks good.

}

// Build creates BaseDataProvidersResponse instance for consistent responses of the data providers.
func (b *BaseDataProvidersResponse) Build(subscriptionID uuid.UUID, topic string, payload interface{}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is changing to string: #6847

Suggested change
func (b *BaseDataProvidersResponse) Build(subscriptionID uuid.UUID, topic string, payload interface{}) {
func (b *BaseDataProvidersResponse) Build(subscriptionID string, topic string, payload interface{}) {

Comment on lines +141 to +142
expectedResponse, ok := expected.(*models.BaseDataProvidersResponse)
require.True(s.T(), ok, "Expected *models.BaseDataProvidersResponse, got %T", expected)
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like you're doing this in a lot of places. maybe create a helper function? something like

func extractPayload[T any](t *testing.T, v interface{}) T {
	response, ok := v.(*BaseDataProvidersResponse)
	require.True(t, ok, "Expected *models.BaseDataProvidersResponse, got %T", v)

	payload, ok := response.Payload.(T)
	require.True(t, ok, "Unexpected response payload type: %T", response.Payload)

	return payload
}

then usage

expectedResponsePayload := extractPayload[*models.AccountStatusesResponse](t, expected)
actualResponsePayload := extractPayload[*models.AccountStatusesResponse](t, actual)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Access] Make response for data providers consistent with action responses
5 participants