Skip to content

Run unit tests on Windows and macOS in CI; track coverage; make test lacks -race #170

Closed

Description

@TMHSDigital

Summary

Unit tests run only on Ubuntu in CI, no coverage is recorded, and make test does not pass -race although README and CONTRIBUTING say it does. The project ships Windows and macOS binaries whose platform-specific code is only smoke-tested through the composite action.

Where

  • .github/workflows/go.yml:15, 21, 70 (build on ubuntu-latest, Go-version matrix only, go test -v -race ./...)
  • .github/workflows/go.yml:109 (3-OS matrix runs only the action)
  • internal/output/file.go:33, 62, 88 (symlink resolution, O_EXCL temp + rename, umask), internal/output/file_unix_test.go:1, main_signal_unix_test.go:1 (unix-only tests)
  • Makefile:38-42 (test target without -race), README.md:238

Details

Platform-sensitive paths (rename over an existing file on Windows, signal handling, path separators) have no Windows or macOS test run. Locally on Windows the suite needs GOTOOLCHAIN=go1.26.3 to avoid a known false -race failure, which CI never surfaces. Measured total coverage is 79.8% with internal/output at 51% and internal/dnsserver at 55%, but nothing tracks it.

Suggested fix

  • Add go test ./... (optionally -short) to the action job's OS matrix, or add an os axis to build
  • Add internal/output/file_windows_test.go: CreateFile over an existing locked file returns a clear error; Close when the target was deleted mid-write; rename-over-existing keeps the old file on failure
  • Emit -coverprofile in CI and upload it as an artifact; fail below a floor (start at 75%)
  • Make make test pass -race or correct README.md:238 and docs/CONTRIBUTING.md

Acceptance criteria

  • Unit tests run on Linux, macOS and Windows in CI
  • Coverage visible per run

Getting started

  • Relevant files: .github/workflows/go.yml, Makefile, internal/output/file.go
  • How to run tests: go test -race ./...
  • Related docs: docs/CONTRIBUTING.md

Filed by repo-audit/full-audit at 3139c44. Severity: medium. Effort: M. audit-key: testing|.github/workflows/go.yml|ci platform and coverage gaps

Activity

  1. added
    ci
    testing
    severity: medium
    on Nov 9, 2026
  2. TMHSDigital commented on Nov 9, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 09dbd54: a new test-os job runs go test -shuffle=on ./... on macos-latest and windows-latest; the stable build leg writes coverage.out, reports the total in the step summary, uploads it as an artifact and fails below 75% (85.0% now). make test keeps no -race, and README/CONTRIBUTING now say CI adds it. Verified by CI run 42621021843: every job green, including both test-os legs. Not done: the optional file_windows_test.go cases from the suggestions.

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

    ciseverity: mediumtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions