Skip to content

perf(test): mock measure_ms in assert_duration failure paths#828

Merged
Chemaclass merged 1 commit into
mainfrom
feat/826-assert-duration-mock-measure-ms
Jul 19, 2026
Merged

perf(test): mock measure_ms in assert_duration failure paths#828
Chemaclass merged 1 commit into
mainfrom
feat/826-assert-duration-mock-measure-ms

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #826

The three failure-path tests in assert_duration_test.sh each paid a real sleep 1 — 3s of the file's 3.3s runtime — only to exercise the threshold comparison and failure message.

💡 Changes

  • Mock bashunit::duration::measure_ms (heredoc form, so call args aren't appended to the fake reading) in failure-path tests: ~3.3s → ~0.4s
  • Keep one success path on a real short sleep so measure_ms integration stays covered end-to-end
  • Guard that test to skip under the last-resort date-seconds clock, whose 1s resolution would read sleep 0.2 as 0ms
  • No changes to src/

https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED

The three failure-path tests only exercise the threshold comparison and
the failure message, yet each paid a real 'sleep 1' — 3s of the file's
3.3s runtime. Mock bashunit::duration::measure_ms (heredoc form, so call
args are not appended to the fake reading) and assert against fake
commands instead: ~3.3s -> ~0.4s.

One success path keeps a real short sleep so measure_ms integration
stays covered end-to-end, guarded to skip under the last-resort
date-seconds clock whose 1s resolution would read 'sleep 0.2' as 0ms.

Closes #826
@Chemaclass Chemaclass added the pure testing Pure testing related label Jul 19, 2026
@Chemaclass Chemaclass self-assigned this Jul 19, 2026
@Chemaclass
Chemaclass merged commit f335e13 into main Jul 19, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the feat/826-assert-duration-mock-measure-ms branch July 19, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pure testing Pure testing related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant