test(clusterloader2): add unit tests for pkg/errors - #4261
test(clusterloader2): add unit tests for pkg/errors#4261HarnageaGabriel wants to merge 1 commit into
Conversation
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.
|
Welcome @HarnageaGabriel! |
|
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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: HarnageaGabriel The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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.go—ErrorList:IsEmpty,Append,Concat(including nil-argument case),Has(includingerrors.Is-wrapped error matching),String,Errorfatal_error.go—NewErrCritical, verifyingerrors.Isunwraps to bothErrCriticaland the original wrapped errormetric_violation_error.go—NewMetricViolationError/IsMetricViolationErrorPackage coverage: 100%.
Relation to #3872
This does not overlap with #3872, which adds a single test (
TestConvertSampleToHistogram) forpkg/measurement/util/histogram.go. This PR targets a different, currently-untested package (pkg/errors) chosen specifically to avoid duplicating that work.Testing
All pass, no other files modified.