goharbor / goharbor/harbor-cli

[feature]: Add Unit Test coverage for Utils

Open
#1,025 0 comments 0 reactions 0 assignees View on GitHub
enhancement status/accepted
Dominant language
Go
Stars
163
Forks
211
Avg merge
1m
Merged PRs (30d)
1

Description

## Problem
pkg/utils/query.go and pkg/utils/reflect.go contain pure logic functions critical to the CLI query building for all list commands, and reflection-based config conversion with zero test coverage.

## Proposed Solution
Add unit tests for both files:
- query_test: BuildQueryParam happy paths, input validation, key validation
- reflect_test: ExtractConfigValues, ConvertToConfigurations, ExtractConfigurationsByCategory, IsCategory

Contributor guide

Open the contributing guide

Research direction

Start by reading the pure logic in pkg/utils/query.go and pkg/utils/reflect.go, then inspect the surrounding utils package for test conventions. Add query_test coverage for BuildQueryParam happy paths, input validation, and key validation, plus reflect_test coverage for ExtractConfigValues, ConvertToConfigurations, ExtractConfigurationsByCategory, and IsCategory. Done means both files have meaningful unit coverage for the listed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.