Skip to content

test(clusterloader2): add unit tests for pkg/errors - #4261

Open
HarnageaGabriel wants to merge 1 commit into
kubernetes:masterfrom
HarnageaGabriel:unit-tests-errors-package
Open

test(clusterloader2): add unit tests for pkg/errors#4261
HarnageaGabriel wants to merge 1 commit into
kubernetes:masterfrom
HarnageaGabriel:unit-tests-errors-package

Conversation

@HarnageaGabriel

Copy link
Copy Markdown

What this PR does

Adds unit test coverage for clusterloader2/pkg/errors, which had zero test files. Part of the broader effort tracked in #572 ("clusterloader2 should be covered with unit tests").

Covers all three source files in the package:

  • error_list.goErrorList: IsEmpty, Append, Concat (including nil-argument case), Has (including errors.Is-wrapped error matching), String, Error
  • fatal_error.goNewErrCritical, verifying errors.Is unwraps to both ErrCritical and the original wrapped error
  • metric_violation_error.goNewMetricViolationError / IsMetricViolationError

Package coverage: 100%.

Relation to #3872

This does not overlap with #3872, which adds a single test (TestConvertSampleToHistogram) for pkg/measurement/util/histogram.go. This PR targets a different, currently-untested package (pkg/errors) chosen specifically to avoid duplicating that work.

Testing

go build ./...
go test ./pkg/errors/... -v -cover
gofmt -l pkg/errors/*_test.go
go vet ./pkg/errors/...

All pass, no other files modified.

Package pkg/errors (ErrorList, fatal error wrapping, metric violation
error) had no unit test coverage. Adds table-driven tests for
ErrorList (Append/Concat/Has/String/Error, including nil Concat and
wrapped-error Has semantics via errors.Is), NewErrCritical, and
NewMetricViolationError/IsMetricViolationError.

Part of kubernetes#572. Does not overlap with kubernetes#3872, which
covers ConvertSampleToHistogram in pkg/measurement/util.
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @HarnageaGabriel!

It looks like this is your first PR to kubernetes/perf-tests 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/perf-tests has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 11, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @HarnageaGabriel. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 11, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from mborsz August 11, 2026 16:48
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: HarnageaGabriel
Once this PR has been reviewed and has the lgtm label, please assign wojtek-t for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested a review from wojtek-t August 11, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant