Open
Conversation
Follows the existing pattern of UnregisterCommand and UnregisterEventData to allow removing aggregate type registrations from the global registry.
Tests that register types into global registries now defer cleanup, preventing duplicate-registration panics on subsequent test iterations. Context marshaler/unmarshaler tests save and restore slice lengths.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Running
go test -count=20panics because test functions register types into global registries without cleanup. On the second iteration the registry rejects duplicates with a panic.Affected Components
Related Issues
None
Solution and Design
UnregisterAggregatefollowing the existing pattern ofUnregisterCommandandUnregisterEventDatadefercleanup in tests that register into global registries (aggregate_test.go,command_test.go,event_test.go)TestCopyContextself-contained instead of relying on side effects from prior testsSteps to test and verify
go test -race -count=20 .— all iterations pass without panics