kubernetes / utils

Non-Kubernetes-specific utility libraries which are consumed by multiple projects.
Apache License 2.0
331 stars 196 forks source link

Ensure set.Equal() compares the two set lengths #286

Closed skitt closed 1 year ago

skitt commented 1 year ago

What type of PR is this?

/kind bug

What this PR does / why we need it:

set.Equal() currently checks the length of the owning set against itself, so a.Equal(b) returns true if a is a superset of b, with no further restriction.

This fixes the length check and adds unit tests to catch this case.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Release note:

skitt commented 1 year ago

/kind bug

k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logicalhan, skitt

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

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[set/OWNERS](https://github.com/kubernetes/utils/blob/master/set/OWNERS)~~ [logicalhan] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment