Repository navigation
Add unit tests for Configuration.Validate, types and WAL view loading - #722
Merged
pfi79 merged 1 commit intoOct 22, 2026
Merged
Conversation
pkg/types had no tests. Cover every check in Configuration.Validate with a table test that starts from DefaultConfig and breaks one field at a time, and cover Proposal.Digest, Checkpoint and RequestInfo.String. Also cover PersistedState.LoadNewViewIfApplicable and LoadViewChangeIfApplicable, which had no unit tests: an empty WAL, a malformed last entry, and a last entry that is a proposal, a new view or a view change. Test-only change. Written by Claude (AI assistant) on behalf of Hagar Meir. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
pfi79
force-pushed
the
test/config-validate-and-state-load
branch
from
October 22, 2026 08:56
34cece7 to
139427d
Compare
pfi79
approved these changes
Oct 22, 2026
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.
Written by Claude (Anthropic's AI assistant) on behalf of Hagar Meir.
pkg/typeshad no tests, andPersistedState.LoadNewViewIfApplicableandLoadViewChangeIfApplicablehad no unit tests.Changes (test only)
pkg/types/config_test.go: a table test for every check inConfiguration.Validate. Each case starts fromDefaultConfigand breaks one field, including the cross-field rules: forward ≤ complain ≤ auto-remove timeouts, the batch size limits, and leader rotation vsDecisionsPerLeader.pkg/types/types_test.go: tests forProposal.Digest(stable, and changes with each field),CheckpointGet/Set, andRequestInfo.String.internal/bft/state_test.go:TestStateLoadIfApplicablecovers an empty WAL, a malformed last entry, and a last entry that is a proposal, a new view or a view change.Coverage
pkg/types: 0% → 98.6% (Validateat 100%).LoadNewViewIfApplicable/LoadViewChangeIfApplicable: 0% → 100%.Testing
golangci-lint run ./...: 0 issues.go vet,gofmt,go test -race ./internal/bft/ ./pkg/types/pass.testintegration package passes.🤖 Generated with Claude Code