Skip to content

feat: add unit test suite #3

Description

@aratan

Problem Description

The project has zero tests. Every code change is a blind deployment — no regression coverage, no safety net for concurrency fixes, no validation of edge cases. This is the highest-risk gap in the project.

Proposed Solution

Add a Go test suite covering at minimum:

  • StateManager (BlockIP, UnblockIP, manageUnblocks, IsBlocked) — concurrency safety under -race
  • MLEngine (AnalyzePacket, feature extraction) — heuristic thresholds
  • SteganographyDetector (AnalyzePacket, calculateEntropy) — entropy boundaries
  • WhitelistManager (Add, Remove, IsWhitelisted) — concurrent read/write patterns
  • ProtocolReconstructionEngine (extractFlowKey, generateSessionID, createNewSession, sessionCleanup) — no data races

The StateManager and WhitelistManager are the highest-value targets due to their concurrent access patterns and the TOCTOU bugs recently fixed.

Affected Area

Code quality / testing

Alternatives Considered

  • Integration tests with a real pcap interface (requires root + hardware) — too heavy for CI
  • Manual testing only — current state, unsustainable

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions