Test/backend coverage - #1
Merged
Merged
Conversation
…d already does An empty /proc/uptime (f.read().split() -> []) or a MemTotal:/ MemAvailable: line with nothing after the colon raised an uncaught IndexError and 500ed the node agent's /metrics endpoint, while the identical parsing pattern in read_load() already degrades gracefully by listing IndexError in its except clause. Both readers now do the same. Found by the new unit test suite; regression-tested there.
85 new tests in two files, no production changes beyond the preceding node-agent fix: - test_units.py (48): node_agent (was 0% - all /proc//sys readers via tmp_path-redirected paths, platform-independent), hardware and healthcheck collector loops (broken out of while True by making asyncio.sleep raise a sentinel; real loopback servers for HTTP/TCP success and refused paths, patched timeouts for the timeout paths), auth token issue/verify edges, state's QueueFull drop-oldest and broken-queue swallow paths, demo's fake_logs generator. - test_framework.py (37): k8s_watch mapping functions against SimpleNamespace-shaped fakes plus the full watch loop with scripted fake watches (retry/backoff, unknown-kind ValueError, CancelledError passthrough, backoff growth), ws connect/full-state/4401/heartbeat/ demo-log-streaming/send-failure paths via TestClient websockets and a direct fake-WebSocket invocation for the disconnect branch, metrics-server payload parsing incl. malformed-usage and API-error resilience, and main.py's cluster-detection/lifespan/readyz/SPA- fallback branches with per-test fresh ClusterState instances. Backend suite: 18 -> 103 tests, coverage 49.6% -> ~99.7% (a single timing-dependent healthcheck branch occasionally reports uncovered). Verified in the CI-equivalent python:3.13-slim container; ruff clean.
|
🎉 This PR is included in version 1.1.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
test coverage from 50% - 99%