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

Fix scenarios where error messages aren't propagated correctly (#424) #425

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

hspedro
Copy link
Collaborator

@hspedro hspedro commented Dec 16, 2024

Porting the routing fix that @felippeduran provided to main/v3. See #424

  • Improve tests for agent and service/remote to expose bad behaviors
  • Breakdown test into multiple ones to make them more clear
  • Fix scenarios where error messages aren't propagated correctly

* Improve tests for agent and service/remote to expose bad behaviors
* Breakdown test into multiple ones to make them more clear
* Fix scenarios where error messages aren't propagated correctly

---------

Co-authored-by: Felippe Durán <felippe.duran@wildlifestudios.com>
@hspedro hspedro self-assigned this Dec 16, 2024
When running tests we need to ensure a graceful cleanup by
terminating/closing the context by calling the Close() method,
which should call the cancelFunc of the group service context.
This should graceful handle goroutines like groupTTLCleanup
with a sane context cancellation
@hspedro hspedro force-pushed the fix/port-error-propagation branch from c4fe5e7 to da69a18 Compare December 16, 2024 13:38
@coveralls
Copy link

Pull Request Test Coverage Report for Build 12353837806

Details

  • 17 of 36 (47.22%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.09%) to 59.299%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/util/util.go 0 3 0.0%
pkg/groups/etcd_group_service.go 0 4 0.0%
pkg/groups/memory_group_service.go 15 27 55.56%
Files with Coverage Reduction New Missed Lines %
pkg/util/util.go 1 62.0%
Totals Coverage Status
Change from base Build 10368957457: 0.09%
Covered Lines: 4923
Relevant Lines: 8302

💛 - Coveralls

Copy link
Contributor

Choose a reason for hiding this comment

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

Will GetErrorFromPayload keep working if the server is using json serializer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. The difference between unmarshalling to e.Error struct and protos.Error is a few internal XXX fields:

// Error is an error with a code, message and metadata
type Error struct {
	Code     string
	Message  string
	Metadata map[string]string
}
type Error struct {
	Code                 string            `protobuf:"bytes,1,opt,name=code" json:"code,omitempty"`
	Msg                  string            `protobuf:"bytes,2,opt,name=msg" json:"msg,omitempty"`
	Metadata             map[string]string `protobuf:"bytes,3,rep,name=metadata" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

So JSON serializer should still be able to serialize to protos.Error struct, just the XXX fields will be empty

Copy link
Contributor

@felipejfc felipejfc left a comment

Choose a reason for hiding this comment

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

only one question. apart from it, LGTM

@hspedro hspedro merged commit afce0c5 into main Dec 18, 2024
4 checks passed
@hspedro hspedro deleted the fix/port-error-propagation branch December 18, 2024 19:28
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.

5 participants