Skip to content

feat: add API reported and health server#3

Merged
krakenhavoc merged 1 commit intomainfrom
feature/probe-report-health
Mar 16, 2026
Merged

feat: add API reported and health server#3
krakenhavoc merged 1 commit intomainfrom
feature/probe-report-health

Conversation

@krakenhavoc
Copy link
Copy Markdown
Contributor

This pull request introduces two new internal packages, health and reporter, which provide HTTP health/readiness endpoints and API communication logic, respectively. Both packages are well-covered with unit tests to ensure correct behavior and error handling.

Health endpoint implementation and testing:

  • Added a new health package with a Server struct that exposes /healthz and /readyz endpoints, tracks probe status, readiness, and scan times, and provides thread-safe updates. (internal/health/health.go)
  • Added comprehensive tests for the health package, covering endpoint responses, readiness state, scan time updates, server start/shutdown, and content type validation. (internal/health/health_test.go)

Reporter (API client) implementation and testing:

  • Introduced a new reporter package that encapsulates API interactions, including registering the probe, reporting scan results, fetching hosted config, handling authentication, rate limiting, retries, and error formatting. (internal/reporter/reporter.go)
  • Added thorough tests for the reporter package, covering successful registration and reporting, error handling (401, 429, 5xx), retry logic, hosted config retrieval, and User-Agent header correctness. (internal/reporter/reporter_test.go)

@krakenhavoc krakenhavoc merged commit 093f5b0 into main Mar 16, 2026
@krakenhavoc krakenhavoc deleted the feature/probe-report-health branch March 16, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant