Skip to content

Add targeted Lua tests for low-coverage runtime branches #25

@levleontiev

Description

@levleontiev

Summary

Add targeted Lua tests to raise coverage in the weakest non-generated runtime modules identified by the new luacov reporting path.

Why

Current non-generated Lua coverage is about 82.28%, but several boundary/error-heavy modules remain materially under-covered.

Current lowest-covered handwritten modules:

  • src/fairvisor/decision_api.lua58.87%
  • src/fairvisor/bundle_loader.lua76.79%
  • src/fairvisor/utils.lua77.05%
  • src/fairvisor/saas_client.lua78.88%
  • src/fairvisor/streaming.lua84.91%

Scope

Add tests for the highest-value missing branches, prioritised in this order:

  1. decision_api.lua
  2. bundle_loader.lua
  3. saas_client.lua
  4. streaming.lua
  5. utils.lua

Target gaps

  • decision_api.lua
    • flat JSON fallback parser branches
    • retry/throttle edge paths
    • non-ngx hash/jitter fallback branches
    • error/no-op logging/guard branches
  • bundle_loader.lua
    • init/deps wiring
    • queue_event failure path
    • descriptor hint extraction branches
    • signing/HMAC fallback path
  • saas_client.lua
    • missing resty.http
    • transport/request_uri failures
    • unhappy-path response handling
  • streaming.lua
    • empty data: events
    • termination/error event paths
    • reconcile failure / early-return branches
  • utils.lua
    • constant-time compare fallback
    • bit/base64 helper branches
    • nil/false return branches

Acceptance Criteria

  • Add focused unit/integration tests for the gaps above.
  • Increase meaningful non-generated Lua coverage above the current baseline.
  • Keep generated code (src/fairvisor/generated/) out of the success metric.
  • All existing unit, integration, and E2E suites still pass.

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