Skip to content

test: refactor histogram tests to a table-driven layout#172

Open
anshika07012 wants to merge 1 commit into
optiqor:mainfrom
anshika07012:feature/table-driven-histogram-tests
Open

test: refactor histogram tests to a table-driven layout#172
anshika07012 wants to merge 1 commit into
optiqor:mainfrom
anshika07012:feature/table-driven-histogram-tests

Conversation

@anshika07012

Copy link
Copy Markdown

What

Refactors the sequential log2 bucket math test cases in histogram_test.go into a single, clean table-driven layout.

Why

Fixes #133

How

  • Consolidated the 9 original sequential testing paths into a unified TestHistogramTableDriven suite matching the design style found in internal/cli/trace_test.go.
  • Leveraged t.Run() and t.Parallel() to handle subtests concurrently and ensure safe iteration isolation.
  • Explicitly expanded input parameter boundaries to cover zero/empty inputs, single value allocations, exact log2 bucket edges, one-past-the-bucket edges, and max bucket clamping at bucket 63.
  • Maintained all original value calculations, assertions, and downstream component tests (Merge, Reset, etc.) intact to prevent regressions.

Testing

  • go build ./... passes

  • go test ./... passes

  • go vet ./... passes

  • golangci-lint run ./... passes

  • Tested locally with: go test -v inside internal/collector/aggregator

  • N/A — pure docs/refactor

  • sudo ./bin/bpf-verify --read 5s confirms 6/6 programs still load

  • ./scripts/verify.sh passes (or specific phase: ./scripts/verify.sh quality)

Checklist

  • PR title follows Conventional Commits (test(collector): refactor histogram tests to table-driven layout)
  • All commits are DCO-signed (git commit -s)
  • No unrelated changes pulled in
  • Documentation updated where user-visible behavior changed
  • Added/updated tests for new code paths
  • If a new doctor rule, paired with a chaos scenario in scripts/verify.sh

@anshika07012 anshika07012 requested a review from btwshivam as a code owner June 3, 2026 16:03
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🚀 First PR — welcome aboard!

A few things to expect:

  1. CI: every PR runs build + race tests + lint + (eventually) the kernel matrix. If something fails, the log will tell you exactly which gate.
  2. DCO: every commit needs Signed-off-by:git commit -s adds it automatically.
  3. Conventional Commits: PR titles like feat(doctor): add new rule or fix(bpf): handle X. We squash-merge by default.
  4. Review: a maintainer will review within 72 hours. Suggestions are conversations, not orders — push back if something doesn't fit your context.

If you get stuck, reply here or jump to Discussions. We want this PR to land.

@github-actions github-actions Bot added testing Tests and test coverage area/doctor Diagnostic engine and rules area/perf Performance and throughput level:advanced 200+ lines or 6+ files (auto-applied) labels Jun 3, 2026
@anshika07012 anshika07012 force-pushed the feature/table-driven-histogram-tests branch 2 times, most recently from 15310ed to 50eb1ee Compare June 3, 2026 16:41
@anshika07012 anshika07012 force-pushed the feature/table-driven-histogram-tests branch from 50eb1ee to 2708ad9 Compare June 3, 2026 16:43
@anshika07012 anshika07012 deleted the feature/table-driven-histogram-tests branch June 6, 2026 16:13
@anshika07012 anshika07012 restored the feature/table-driven-histogram-tests branch June 6, 2026 16:14
@anshika07012 anshika07012 reopened this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/doctor Diagnostic engine and rules area/perf Performance and throughput level:advanced 200+ lines or 6+ files (auto-applied) testing Tests and test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(collector): table-drive histogram_test.go

1 participant