Skip to content

Test: add comprehensive IPFIX coverage tests (+31.4% coverage)#137

Open
dmabry wants to merge 1 commit into
mainfrom
feature/ipfix-test-coverage
Open

Test: add comprehensive IPFIX coverage tests (+31.4% coverage)#137
dmabry wants to merge 1 commit into
mainfrom
feature/ipfix-test-coverage

Conversation

@dmabry
Copy link
Copy Markdown
Owner

@dmabry dmabry commented May 15, 2026

Summary

Adds 29 new tests targeting previously untested IPFIX code paths, bringing package coverage from 53.3% → 84.7%.

New Tests (633 lines)

Options Template & Data

  • OptionsTemplateFlowSet.Generate — scope/data field validation
  • OptionsDataFlowSet.Generate — record fields, FlowSetID
  • GenerateOptionsDataIPFIX — process metadata, PID verification
  • Options Data ToBytes serialization & buffer length verification
  • Options Template + Data combined roundtrip parsing

Minimal IPFIX Profile

  • MinimalIPFIXProfile.Name / TemplateFields
  • MinimalIPFIXFlow.Generate — IPv4, IPv6, all protocol ports

Extended IPFIX Profile

  • ExtendedIPFIXProfile.Name / TemplateFields

Generic IPFIX Profile

  • GenericIPFIXProfile.Name
  • GenericFlow.Generate — all 14 protocol port mappings

Debug Helpers

  • Header.size(), Header.String()
  • TemplateFlowSet.size(), DataFlowSet.size()
  • GetIPFIXSizes()

Edge Cases

  • IsValidIPFIX: too-short, empty, wrong version
  • UpdateTimeStamp: too-short, empty, payload preservation
  • DataFlowSet.Generate with zero flow count

Coverage Delta

Function Before After
OptionsDataFlowSet.Generate 0% 100%
GenerateOptionsDataIPFIX 0% 100%
MinimalIPFIXFlow.Generate 0% 100%
MinimalIPFIXProfile.TemplateFields 0% 100%
ExtendedIPFIXProfile.TemplateFields 0% 100%
Header.size(), String() 0% 100%
TemplateFlowSet.size() 0% 100%
DataFlowSet.size() 0% 100%
GetIPFIXSizes() 0% 100%
ToBytes 48.1% 60.8%
UpdateTimeStamp 73.3% 80.0%
Total 53.3% 84.7%

Verified

  • go build
  • go vet ./...
  • go test -v ./ipfix/ -count 1 ✅ 29 new tests passing
  • go test -race ./... ✅ No races detected

Add 29 new tests targeting previously untested IPFIX code paths:

Options Template & Data:
- OptionsTemplateFlowSet.Generate (scope/data field validation)
- OptionsDataFlowSet.Generate (record fields, FlowSetID)
- GenerateOptionsDataIPFIX (process metadata, PID)
- Options Data ToBytes serialization & buffer length verification
- Options Template + Data combined roundtrip parsing

Minimal IPFIX Profile:
- MinimalIPFIXProfile.Name/TemplateFields
- MinimalIPFIXFlow.Generate (IPv4, IPv6, all protocol ports)

Extended IPFIX Profile:
- ExtendedIPFIXProfile.Name/TemplateFields

Generic IPFIX Profile:
- GenericIPFIXProfile.Name
- GenericFlow.Generate all 14 protocol port mappings

Debug helpers:
- Header.size(), Header.String()
- TemplateFlowSet.size(), DataFlowSet.size()
- GetIPFIXSizes()

Edge cases:
- IsValidIPFIX: too-short, empty, wrong version
- UpdateTimeStamp: too-short, empty, payload preservation
- DataFlowSet.Generate with zero flow count

Coverage: 53.3% → 84.7% (+31.4 percentage points)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant