Skip to content

[TASK] timpani-o: Improve unit test coverage (#74)#75

Merged
basheerFZ merged 1 commit into
eclipse-timpani:development_0.5from
jayakrishnan04b:development_0.5
May 14, 2026
Merged

[TASK] timpani-o: Improve unit test coverage (#74)#75
basheerFZ merged 1 commit into
eclipse-timpani:development_0.5from
jayakrishnan04b:development_0.5

Conversation

@jayakrishnan04b
Copy link
Copy Markdown
Contributor

Closes #74

Summary

Adds 20 new unit tests to timpani_rust/timpani-o, increasing overall
code 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 node
  • NoAvailableCpu rejection when all CPUs on target node are saturated
  • CpuAffinityUnavailable when pinned CPU absent from target node's CPU set
  • NoSchedulableNode for least_loaded (task memory exceeds all nodes)
  • NoSchedulableNode for best_fit_decreasing (task memory exceeds all nodes)
  • best_fit_decreasing target_node fallback warning path

src/hyperperiod/mod.rs — 75.5% → 95.9% (+20.4%)

  • Display impl for all three HyperperiodError variants
    (NoValidPeriods, Overflow, TooLarge)
  • Default::default() impl for HyperperiodManager
  • clear_all() noop branch (called on an already-empty map)
  • calculate_hyperperiod debug loop exercised with 3 distinct periods

src/fault/mod.rs

  • Invalid URI error path in FaultClient::connect_lazy
  • FaultNotification struct field storage assertions
  • node_id field recording via mock notifier

src/main.rs

  • Extract build_pullpiri_addr() as a pure, testable free function
  • CLI flag defaults verified via Cli::try_parse_from (no argv access)
  • Short flag parsing (-s, -f, -p, -d)
  • --nodeconfig path flag
  • --notifyfault / -n flag

Test Results

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).
@basheerFZ basheerFZ self-requested a review May 14, 2026 14:55
@basheerFZ basheerFZ added the enhancement New feature or request label May 14, 2026
@basheerFZ basheerFZ moved this from Backlog to In progress in timpani Development May 14, 2026
@basheerFZ basheerFZ added this to the Q2 (Milestone-2) milestone May 14, 2026
Copy link
Copy Markdown
Contributor

@basheerFZ basheerFZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code coverage increased to 82%

@basheerFZ basheerFZ merged commit 8ec3b9b into eclipse-timpani:development_0.5 May 14, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in timpani Development May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants