Skip to content

Test coverage: expand tests to cover all library, CLI and web behaviour #44

Closed

Description

@CodingAnarchy

Part of #7. Measured with cargo llvm-cov on master @ 5d7d93e. The full workspace suite ran in both CI styles against PostgreSQL 16 and MySQL 8, with --include-ignored. Test files, examples and integrations are excluded.

Crate Line coverage Uncovered lines
hammerwork (library) 84.9% 3,701 / 24,558
hammerwork-web 55.7% 1,723 / 3,891
cargo-hammerwork (CLI) 32.1% 4,931 / 7,257

Library hot spots (uncovered lines, coverage)

  • worker.rs 487 (77.7%): config wiring (with_config, with_hammerwork_config, WorkerPool::from_config), autoscaling, metrics/alerting integration, batch processing paths
  • encryption/engine.rs 340 (72.5%), encryption/envelope.rs 204 (61.7%), encryption/azure.rs 50 (0%), encryption/kms.rs 41 (78.6%)
  • metrics.rs 201 (59.5%), tracing.rs 109 (65.4%)
  • streaming.rs 255, key_manager.rs 250, queue/mysql.rs 239, queue/postgres.rs 210, alerting.rs 157, retry.rs 154 (77.4%), queue/mod.rs 102 (74.0%; includes JobQueue::from_config), spawn.rs 86 (36.3%)

CLI (cargo-hammerwork)

queue (0%), cron (0%), utils/display (0%), utils/db_helpers (0%), archive (5%), monitor (6%), maintenance (14%), backup (18%), migration (20%), config (26%), batch / spawn / workflow / job / webhook (39–48%)

Web (hammerwork-web)

api/jobs.rs (26%), websocket.rs (40%), api/queues.rs (43%), api/system.rs / api/stats.rs / api/archive.rs (~50%), main.rs (10%)

Goals

  • Test behaviour, not lines: every public API and every CLI command/flag, and every HTTP endpoint (success and error paths) gets a test. DB-backed paths are tested on both backends.
  • Targets: library ≥ 90% lines, web ≥ 80%, CLI ≥ 80%. Document what's left uncovered and why (e.g. real cloud services), and use fakes or mocks where possible.
  • Add a CI coverage job (cargo llvm-cov across both DB jobs, merged) that fails below a floor set just under the achieved numbers, so coverage can't regress.

Activity

  1. 4 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions