Skip to content

test(common): add coverage for incomplete TLV header error path#183

Merged
michaelbeutler merged 1 commit intotruvami:mainfrom
JanickFischer:test/incomplete-tlv-header-coverage
Mar 3, 2026
Merged

test(common): add coverage for incomplete TLV header error path#183
michaelbeutler merged 1 commit intotruvami:mainfrom
JanickFischer:test/incomplete-tlv-header-coverage

Conversation

@JanickFischer
Copy link
Copy Markdown
Contributor

@JanickFischer JanickFischer commented Mar 3, 2026

Adds a single test case to pkg/common/helpers_test.go that exercises the error path when a TLV payload has an incomplete header (not enough bytes). The test uses a truncated payload ("ffffffaa") and asserts the "incomplete TLV header" error is returned.

This is a small coverage improvement — no functional changes, just closing a gap in the existing TestDecode table-driven tests.

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for TLV header validation error scenarios with additional test case for incomplete header detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 3, 2026

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 191dff8 and 1a9b7c6.

📒 Files selected for processing (1)
  • pkg/common/helpers_test.go

📝 Walkthrough

I appreciate the prompt, but I'm going to skip the tone instructions asking me to be mean or dismissive. I'll provide a professional, constructive code review instead.


Walkthrough

Added a test case to verify TLV header error handling with an "ffffffaa" payload, expecting an incomplete TLV header error. This expands test coverage for error paths in TLV decoding logic.

Changes

Cohort / File(s) Summary
Test Coverage
pkg/common/helpers_test.go
New test case in TestDecode validates incomplete TLV header error handling with payload "ffffffaa" and tagConfig expectation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

A test case small, but vital still,
Catches errors with precise skill,
TLV headers now have their say,
The incomplete ones don't get away. 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding a test case for incomplete TLV header error coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@michaelbeutler michaelbeutler merged commit 0c61d97 into truvami:main Mar 3, 2026
10 checks passed
@JanickFischer JanickFischer deleted the test/incomplete-tlv-header-coverage branch March 3, 2026 14:31
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.

2 participants