Summary
The malwaremanager, healthmanager, and nodeprofilemanager packages currently have no dedicated unit tests, leaving important node-agent functionality without direct automated coverage.
The missing coverage is particularly relevant because these managers contain meaningful behavior around health probes, malware event handling and scanner interaction, container lifecycle state, node profile generation, and profile reporting.
Adding focused unit tests would improve regression detection and make changes to these components safer to maintain.
Current state
The following packages currently contain no _test.go files:
pkg/malwaremanager/
pkg/healthmanager/
pkg/nodeprofilemanager/
The relevant implementation is spread across:
pkg/healthmanager/health_manager.go
pkg/malwaremanager/v1/malware_manager.go
pkg/malwaremanager/v1/clamav/
pkg/malwaremanager/v1/types/
pkg/nodeprofilemanager/v1/nodeprofile_manager.go
The repository already contains established unit-testing patterns in other managers and packages that can be followed for these components.
Suggested scope
Add focused unit tests for:
pkg/healthmanager
Cover:
NewHealthManager
- liveness probe behavior
- readiness probe behavior for relevant watcher states
- container watcher assignment
pkg/malwaremanager
Cover the meaningful behavior of the v1 implementation and associated result types, including:
- manager initialization when malware scanning is not configured
- malware scanner interactions through mocks
- supported exec/open event handling
- unsupported event handling
- file-open filtering behavior
- container lifecycle bookkeeping
- malware result metadata and workload details
External ClamAV or other runtime services should not be required for the unit tests.
pkg/nodeprofilemanager
Cover:
- manager initialization and configuration
- container state interpretation
- pod state interpretation
- node profile construction
- application label handling
- container and ephemeral-container profile data
- profile submission success and failure cases
HTTP interactions should be isolated through test servers or existing repository testing patterns rather than requiring an external service.
Expected outcome
The three previously untested manager areas should have maintainable, meaningful unit-test coverage consistent with the rest of kubescape/node-agent.
The resulting tests should provide confidence against regressions without introducing unrelated changes or additional runtime dependencies.
Summary
The
malwaremanager,healthmanager, andnodeprofilemanagerpackages currently have no dedicated unit tests, leaving important node-agent functionality without direct automated coverage.The missing coverage is particularly relevant because these managers contain meaningful behavior around health probes, malware event handling and scanner interaction, container lifecycle state, node profile generation, and profile reporting.
Adding focused unit tests would improve regression detection and make changes to these components safer to maintain.
Current state
The following packages currently contain no
_test.gofiles:The relevant implementation is spread across:
pkg/healthmanager/health_manager.gopkg/malwaremanager/v1/malware_manager.gopkg/malwaremanager/v1/clamav/pkg/malwaremanager/v1/types/pkg/nodeprofilemanager/v1/nodeprofile_manager.goThe repository already contains established unit-testing patterns in other managers and packages that can be followed for these components.
Suggested scope
Add focused unit tests for:
pkg/healthmanagerCover:
NewHealthManagerpkg/malwaremanagerCover the meaningful behavior of the
v1implementation and associated result types, including:External ClamAV or other runtime services should not be required for the unit tests.
pkg/nodeprofilemanagerCover:
HTTP interactions should be isolated through test servers or existing repository testing patterns rather than requiring an external service.
Expected outcome
The three previously untested manager areas should have maintainable, meaningful unit-test coverage consistent with the rest of
kubescape/node-agent.The resulting tests should provide confidence against regressions without introducing unrelated changes or additional runtime dependencies.