Skip to content

test: add unit tests for internal/axonops API client #76

Description

@digiserg

Summary

internal/axonops/ has 0% test coverage across 1046 lines. This is the core I/O boundary — every CRD controller depends on it. Edge cases (malformed JSON, 204 with decode, URL construction with special chars, error classification) are untested directly.

Testing Requirements

Add internal/axonops/client_test.go with httptest-based tests:

  • TestNewClient_Validation — empty host/orgID/apiKey rejected
  • TestGetMetricAlertRules_Success / _APIError / _MalformedJSON
  • TestCreateOrUpdateMetricAlertRule_GeneratesUUID / _Success / _APIError
  • TestDeleteMetricAlertRule_Success / _404Tolerated
  • TestCreateKafkaTopic_Success / _APIError
  • TestDeleteKafkaACL_Success
  • TestCreateScheduledSnapshot_Success
  • TestDeleteScheduledRepair_QueryParamID
  • TestSetAuthHeader_TokenType
  • TestAPIError_IsRetryable — 4xx returns false, 5xx returns true

Acceptance Criteria

  1. internal/axonops/ coverage > 70%
  2. All client methods have at least success + error test
  3. go test -race ./internal/axonops/ passes

Priority

P1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions