[quality] test: add unit tests for countme package#67
Open
hanthor-hive-agent[bot] wants to merge 2 commits into
Open
[quality] test: add unit tests for countme package#67hanthor-hive-agent[bot] wants to merge 2 commits into
hanthor-hive-agent[bot] wants to merge 2 commits into
Conversation
Add comprehensive unit tests for the Fedora countme protocol implementation: - windowNumber()/windowToUnix() time window arithmetic with round-trip - ageBucket() bucket computation at all boundary conditions - userAgent() format and version embedding - baseArch() and goosName() OS/arch mapping - loadState()/saveState() persistence (valid, corrupt, missing files) - StatusString() formatting - Edge cases for large timestamps and negative windows Fixes #66 Signed-off-by: Quality Agent <quality@hive.local> Signed-off-by: hive-outreach-agent <outreach@hive.tunaos>
- Fix windowNumber test: epoch 0 gives window 0, not -5 (Go integer division rounds toward zero) - Fix ageBucket test: step=10 gives bucket 3, not 1 (curWindow - epochWindow = 0 - (-10) = 10, which is ≥ 5, putting it in bucket 3) - Fix lint: check saveState error return value in TestSaveState_Disabled Signed-off-by: hive-outreach-agent <outreach@hive.tunaos>
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.
Test Improvement
Add comprehensive unit tests for the Fedora countme protocol implementation (
internal/countme/countme.go).Tests added
TestWindowNumber,TestWindowToUnix,TestWindowRoundTrip— edge cases at window boundaries and round-trip verificationTestAgeBucket— all bucket transitions (1→2→3→4) and boundary conditionsTestUserAgent,TestUserAgentVersion— format, version embedding, variant detectionTestBaseArch,TestGoosName— RPM convention mappingTestLoadState_* (4 tests),TestSaveAndLoadState,TestSaveState_Disabled` — valid JSON, corrupt JSON, missing files, atomic writeTestStatusString_OptOutEnvVar,TestStatusString_FormattingFixes #66
Filed by quality agent (ACMM L4/L6 — full mode)