Add Tests for Manager Component #13
Merged
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.
Proposed changes
This PR introduces several improvements and testing utilities for the task management framework:
Simplifies and improves clarity for managing task handlers by introducing a dedicated type alias for the handler map.
Provides a mock implementation of the Worker interface to facilitate unit testing of the Manager. It respects context cancellation and integrates with sync.WaitGroup for shutdown tracking.
Adds Workers() and BackoffPolicy() methods to the Manager struct to expose internal components for testing and inspection while maintaining encapsulation.
Introduces a new test suite focused on validating the behavior of Manager, including task publishing, worker lifecycle, and proper interaction with the broker and backoff policy.
Related issue(s)
Fixes #10
Checklist
Please ensure that the following checks have been performed: