Skip to content

Test/backend coverage - #1

Merged
lukislp merged 2 commits into
masterfrom
test/backend-coverage
Aug 6, 2026
Merged

Test/backend coverage#1
lukislp merged 2 commits into
masterfrom
test/backend-coverage

Conversation

@lukislp

@lukislp lukislp commented Aug 6, 2026

Copy link
Copy Markdown
Owner

test coverage from 50% - 99%

lukislp added 2 commits August 6, 2026 12:24
…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.
Copilot AI lite review requested due to automatic review settings August 6, 2026 10:26
@lukislp
lukislp merged commit 50b1fb2 into master Aug 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants