Skip to content

test: improve automated test coverage#476

Open
svietry wants to merge 1 commit into
mainfrom
improve-tests
Open

test: improve automated test coverage#476
svietry wants to merge 1 commit into
mainfrom
improve-tests

Conversation

@svietry
Copy link
Copy Markdown
Contributor

@svietry svietry commented Feb 23, 2026

Overall coverage: 67.8% -> 73.4% (+5.6 percentage points)

New test files created

  1. internal/config/user_config_test.go - 10 test cases
    - TestParseUserConf - token, private_key, unknown, empty string inputs
    - TestUserConf_String - valid enums and out-of-range values
  2. internal/config/kube_config_test.go - 24 test cases
    - TestKubeConf_IsKubeConfigFromFile - path set/empty
    - TestKubeConf_IsNonFileKubeConfigValid - 7 field combination scenarios
    - TestKubeConfUser_isValid - PrivateKey, ServiceAccountToken, default
    - TestKubeConf_GetKubeConfigFromConf_* - ServiceAccountToken, PrivateKey, invalid base64
    - TestKubeConf_getAuthInfosFromConf_* - invalid base64 client cert and private key
    - TestKubeConfUser_MarshalJSON/YAML_RedactsSensitiveFields - redaction verification

Existing test files extended

  1. pkg/lib_test.go - 9 new test cases
    - TestReportToStdout - stdout JSON encoding verification
    - TestHandleReport - 4 scenarios: empty account, invalid config, successful post, account route override
    - TestHandleReport_VerboseOutput - verbose flag triggers stdout output
    - TestSetLogger - global logger assignment
  2. internal/anchore/anchoreclient_test.go - 3 new test cases
    - TestAPIClientError_Error - basic, with API details, with controller details

Signed-off-by: Shari Vietry <shari.vietry@gmail.com>
@svietry svietry requested a review from a team as a code owner February 23, 2026 13:59
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