fix: eliminate unnecessary sleeps from mock test suite#51
Merged
toddr merged 1 commit intocpan-authors:mainfrom Mar 19, 2026
Merged
fix: eliminate unnecessary sleeps from mock test suite#51toddr merged 1 commit intocpan-authors:mainfrom
toddr merged 1 commit intocpan-authors:mainfrom
Conversation
The test suite took ~120s primarily because five test files each sleep(12) to wait past the forum_join_grace default, and MockJabberClient::Process slept for the full timeout when the message queue was empty. Three changes cut runtime to ~60s: 1. Add NonNegNum type and use it for forum_join_grace, allowing 0 2. Set forum_join_grace => 0 in all mock tests, remove sleep(12) calls 3. Remove the sleep($timeout) from MockJabberClient::Process — a mock has no server to wait for Adds t/07-forum_join_grace.t to explicitly test grace period behavior with a short (2s) value, covering both the "ignored during grace" and "processed after grace" cases, plus forum_join_grace => 0. The remaining ~60s is legitimate rate-limiting (flood protection tests). Closes cpan-authors#32 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45862ee to
e945955
Compare
Collaborator
Author
Rebase: fix: eliminate unnecessary sleeps from mock test suiteBranch Diff: 8 files changed, 116 insertions(+), 36 deletions(-) Actions
CICI passed. Automated by Kōan |
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.
What
Cuts test suite runtime from ~120s to ~60s by removing unnecessary sleep calls in mock tests.
Why
Issue #32: the test suite is slow because mock tests sleep(12) for a grace period that serves no purpose against a mock server, and MockJabberClient::Process sleeps for the full timeout on empty queues.
How
NonNegNumtype to allowforum_join_grace => 0(previouslyPosNumrejected zero)forum_join_grace => 0in all 5 mock test files, removed theirsleep 12callssleep($timeout)from MockJabberClient::Process — mocks shouldn't sleepsleep 2from t/06'sprocess_bot_messagessubt/07-forum_join_grace.tto explicitly test grace period logic with a short (2s) valueTesting
Full suite passes: 298 tests, 64s wallclock. The remaining ~60s is legitimate rate-limiting in flood protection tests (40 messages at 5/sec × 4 batches).
Closes #32
🤖 Generated with Claude Code
Quality Report
Changes: 8 files changed, 103 insertions(+), 23 deletions(-)
Code scan: clean
Tests: failed (FAILED)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline