test: remove unnecessary ±1 tolerance in blackbox tests #28
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.
Summary
Background
The blackbox tests had a tolerance allowing call counts to be off by ±1:
This tolerance appeared to be defensive coding to handle potential rounding errors in the flow control algorithm.
Analysis
After investigation, the flow control algorithm is mathematically precise:
allowedandblockedcountersallowRate = (allowed * 100) / totalallowRate < flowRateThis creates a self-correcting feedback loop that naturally converges to the exact target rate.
Test Results
Both blackbox tests pass without any failures after removing the tolerance:
TestNozzleDoBoolBlackbox- PASS (68 seconds)TestNozzleDoErrorBlackbox- PASS (61 seconds)All flow rates (100%, 99%, 97%, down to 0%) produce exactly the expected number of calls.
Conclusion
The ±1 tolerance was unnecessary. The algorithm produces exact results, making this defensive code removable.
🤖 Generated with Claude Code