[TASK] timpani-o: Improve unit test coverage (#74)#75
Merged
basheerFZ merged 1 commit intoMay 14, 2026
Merged
Conversation
Add 20 new unit tests across 4 source files to increase overall code
coverage from 76.18% to 82.08% (+5.9%, +39 lines covered).
Per-file improvements:
- hyperperiod/mod.rs: 75.5% → 95.9% (+20.4%)
- Display impl for all 3 HyperperiodError variants (NoValidPeriods,
Overflow, TooLarge)
- Default::default() impl for HyperperiodManager
- clear_all() noop branch (empty map)
- calculate_hyperperiod debug loop with multiple unique periods
- scheduler/mod.rs: 81.8% → 95.7% (+13.9%)
- sorted_cpus() public helper (prefer-high, prefer-low, unknown node)
- NoAvailableCpu rejection via saturated pinned CPUs
- CpuAffinityUnavailable when pinned CPU not present on target node
- NoSchedulableNode for least_loaded (impossible memory requirement)
- NoSchedulableNode for best_fit_decreasing (impossible memory)
- best_fit_decreasing target_node fallback warning path
- main.rs: 0% → 2.4%
- Extract build_pullpiri_addr() as a pure testable helper
- CLI defaults verified via Cli::try_parse_from (no argv required)
- Short flag parsing (-s, -f, -p, -d)
- --nodeconfig path parsing
- --notifyfault / -n flag
- fault/mod.rs: tests added for invalid URI, struct fields, node_id
recording (production notify_fault body requires live gRPC server)
All 142 tests pass (was 119 before this change).
a962122 to
be833ab
Compare
basheerFZ
approved these changes
May 14, 2026
Contributor
basheerFZ
left a comment
There was a problem hiding this comment.
Code coverage increased to 82%
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.
Closes #74
Summary
Adds 20 new unit tests to
timpani_rust/timpani-o, increasing overallcode coverage from 76.18% → 82.08% (+5.9%, +39 lines covered).
Test count increased from 119 → 142 (all passing, 0 failures).
Changes
src/scheduler/mod.rs— 81.8% → 95.7% (+13.9%)sorted_cpus()public helper — prefer-high-util, prefer-low-util, unknown nodeNoAvailableCpurejection when all CPUs on target node are saturatedCpuAffinityUnavailablewhen pinned CPU absent from target node's CPU setNoSchedulableNodeforleast_loaded(task memory exceeds all nodes)NoSchedulableNodeforbest_fit_decreasing(task memory exceeds all nodes)best_fit_decreasingtarget_node fallback warning pathsrc/hyperperiod/mod.rs— 75.5% → 95.9% (+20.4%)Displayimpl for all threeHyperperiodErrorvariants(
NoValidPeriods,Overflow,TooLarge)Default::default()impl forHyperperiodManagerclear_all()noop branch (called on an already-empty map)calculate_hyperperioddebug loop exercised with 3 distinct periodssrc/fault/mod.rsFaultClient::connect_lazyFaultNotificationstruct field storage assertionsnode_idfield recording via mock notifiersrc/main.rsbuild_pullpiri_addr()as a pure, testable free functionCli::try_parse_from(no argv access)-s,-f,-p,-d)--nodeconfigpath flag--notifyfault/-nflagTest Results