Add comprehensive tests for tree size validation#13
Open
0x687931 wants to merge 109 commits intokevinmcaleer:mainfrom
Open
Add comprehensive tests for tree size validation#130x687931 wants to merge 109 commits intokevinmcaleer:mainfrom
0x687931 wants to merge 109 commits intokevinmcaleer:mainfrom
Conversation
…dater-functionality Refactor MicroPython OTA updater with release manifests and verification
…set-creation feat: support manifestless updates using Git tree
…or-ota-client Add dual channel OTA client with verification and rollback
…re-download Add startup rollback checks and manifest signing
…ort-error Add MicroPython compatibility flag and drop future annotations
…for-pico-w Add MicroPython os.path shim and test instructions
…use-path-helper-xp43dw Refactor path handling in OTA client
…use-path-helper Refactor path handling in OTA client
Add debug flag for verbose OTA logging
…_client.py Handle non-200 responses in OTA JSON fetch
Handle missing release in resolve_stable
…n-_get feat: support configurable HTTP timeouts
…put-options Clarify JSON configuration in README
…or-micropython Handle MicroPython timeout semantics
…le-for-updates feat: allow forcing updates and clarify config
…nore-.git-entries Exclude Git metadata from manifest
…ion-error chore: add pyproject for packaging
…ng-error Remove PyPI publish workflow
…ease-version Log release version when updating stable manifest
…lper-method feat: shorten debug commit hashes
…and-usage Centralize path filtering across OTA operations
…handling-functions Add tests for path filtering and candidate selection
…h-validation Add path normalization to prevent traversal in OTA paths
…/ignore-lists Normalize OTA allow/ignore path handling
…ltering docs: document path filtering semantics
…gging Add info-level messaging and refine debug output
…-normalize-paths Normalize path checks and improve OTA error handling
…cks-in-ota.py Log filters and restrict manifest to allowed files
The OTA updater is now version 3.0.0 with production-ready delta updates and multi-connectivity framework. All critical reliability improvements from the IoT expert review have been implemented, tested, and documented. The system is optimized for harsh remote deployments including solar-powered sensors, off-grid monitoring stations, and battery-powered IoT devices.
Implements test suite for fetch_tree() tree size limits validation: - test_fetch_tree_normal_size: Validates 100 files under limit passes - test_fetch_tree_too_many_files: Validates 500 files over limit raises OTAError - test_fetch_tree_size_limit_via_header: Validates Content-Length checking - test_fetch_tree_custom_limits: Validates custom config limits are respected - test_fetch_tree_helpful_error_message: Ensures error messages include guidance - Additional edge case tests: empty trees, exact limits, one-over-limit Tests follow established patterns from tests/test_path_filtering.py and tests/test_verify.py, using monkeypatch for dependency isolation and pytest.raises for error validation. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
Implements comprehensive test suite for
fetch_tree()tree size limit validation as specified in Fix #2. Tests validate that the OTA client properly rejects trees that exceed configured size or file count limits.Test Coverage
Core Test Cases (as required):
Additional Edge Cases:
Implementation Notes
test_path_filtering.pyandtest_verify.pymonkeypatchfor dependency isolation (no real network calls)Resp,RespWithContentLength) simulate GitHub API responsesmax_tree_files) and byte size limits (max_tree_bytes)Test File
/Users/am/Documents/GitHub/ota/tests/test_tree_limits.pyDependencies
These tests expect the
fetch_tree()method to be updated with validation logic that:Content-Lengthheader againstmax_tree_bytesconfig (if set)max_tree_filesconfigOTAErrorwith helpful messages including actual values, limits, and guidanceReady to run with
pytest tests/test_tree_limits.pyonce validation is implemented.Generated with Claude Code