Feature/improve test coverage#119
Open
dmabry wants to merge 6 commits into
Open
Conversation
- TestNew: Verify Manager initialization - TestContext/Cancel/WaitGroup/Wait: Test all public methods - TestSetupSignalHandler: Test signal handler setup - TestSignalHandlerIntegration: Test cancellation propagation - TestWaitWithMultipleGoroutines: Test WaitGroup coordination - TestContextCancellation: Test context-based cancellation - TestMultipleCancelCalls: Test idempotency - All tests pass with race detector
- TestConfig: Config struct initialization and zero values - TestWorkerStat: WorkerStat struct initialization and zero values - TestRecordStatIncrValid/IncrInvalid: Atomic counter increments - TestRecordStatConcurrentAccess: Thread safety with concurrent increments - TestRecordStatConcurrentMixedAccess: Mixed concurrent read/write operations - TestStatTotals: StatTotals struct initialization - TestWorkerStats: Slice of WorkerStat - TestHealth: Health struct initialization - TestDashboardPage: DashboardPage struct with nested fields - All tests pass with race detector - 100% code coverage achieved
- TestCollectorRun: Stat collection loop with ticker - TestCollectorRunWithLargeVolume: High volume stat processing - TestCollectorRunContextCancellation: Context-based shutdown - TestCollectorStatsHandler: JSON endpoint for worker stats - TestCollectorStatsHandlerWithEmptyMap: Empty stats handling - TestCollectorStatsHandlerWithError: Error handling in handler - TestCollectorDashboardHandler: HTML dashboard rendering - TestCollectorDashboardHandlerWithNilConfig: Nil config handling - TestCollectorStop: Channel closure verification - TestCollectorStopMultipleTimes: Idempotency test (known limitation) - TestCollectorStatsAggregation: Stats aggregation logic - TestCollectorChannelBuffering: Buffered channel handling - TestCollectorConcurrentAccess: Thread safety with multiple senders - All tests pass with race detector
- TestSingleCommandParseFlags: Flag parsing and defaults for single mode - TestProxyCommandParseFlags: Flag parsing, target flags, and defaults for proxy mode - TestTargetFlagsSet/String: Custom flag type for multiple targets - TestRecordCommandParseFlags: Flag parsing and defaults for record mode - TestReplayCommandParseFlags: Flag parsing, updatets flag, and defaults for replay mode - TestBarrageCommandParseFlags: Flag parsing, web flags, config flag, and defaults for barrage mode - All ParseFlags methods achieve 100% coverage - Execute/Run* functions not tested (delegate to already-tested packages) - All tests pass with race detector
- TestGenerateNetflow: Main NetFlow generation function - TestIsValidNetFlow: Validation with correct/wrong versions and invalid payloads - TestUpdateTimeStamp: Timestamp update functionality - TestGetNetFlowSizes: Size reporting for header, template, and data - TestHeaderSize/String: Header methods coverage - TestFieldString: Field String method - TestTemplateSize/sizeOfFields: Template size calculations - TestTemplateFlowSetSize: TemplateFlowSet size method - TestToBytesWithEmptyFlowSets: Edge case with no flow sets - TestGenericFlowGenerateWithDifferentPorts: Various port/protocol combinations - TestGenericFlowGenerateWithInvalidIP: Invalid IP handling - TestDataFlowSetGenerateWithZeroPort/SpecificPort: Port selection logic - TestTemplateFlowSetGenerateWithPadding: Padding calculation - All previously uncovered functions now at 100% coverage - ToBytes remains at 63.3% (error paths hard to trigger) - Overall coverage improved from 54.3% to 88.4% - All tests pass with race detector
- TestHealthHandler: Health endpoint with JSON response verification - TestIndexHandler: Index endpoint with JSON response verification - TestIndexHandlerErrorPath/HealthHandlerErrorPath: Error handling paths - TestIndexHandlerWithDifferentMethods/HealthHandlerWithDifferentMethods: Multiple HTTP methods - TestRunWebServer: Web server startup, endpoint testing, and shutdown - TestRunWebServerWithDifferentPorts: Server on multiple ports - TestRunWebServerWithDifferentIPs: Server on different IP addresses - TestRunWebServerContextCancellation: Context-based shutdown verification - TestRunWebServerEndpoints: All registered endpoints (/health, /stats, /dashboard) - Improved coverage from 66.7% to 77.8% - RunWebServer at 88.2%, handlers at 60% (error paths hard to trigger) - All tests pass with race detector
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.
No description provided.