Skip to content

Conversation

tobschli
Copy link
Member

@tobschli tobschli commented Mar 7, 2025

How to categorize this PR?

/area testing
/kind cleanup

What this PR does / why we need it:
As mentioned in #11386 (comment), this change aligns the output to this change, improving test output in error cases.

Before, we just used the gstruct matcher in this case to see if names of Objects align. In an error case, ginkgo prints out the entire struct (which are lists in this case), leading to truncated output.

With this change, this test also just matches for the name, shortening the output and making it more readable

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

I was not sure where to extract the objectNames() function to, for me this place felt the most fitting, because I could not find a better place in test/utils. I am not satisfied with the name of the package, but could not find a better one.

Release note:

The `ObjectNames()` function of `github.com/gardener/gardener/test/utils/matchers` can be used to modify `object.Object` lists to a `[]string` with their name. This is useful in tests to avoid using `gstruct` matchers that bloat the test output.

@gardener-prow gardener-prow bot added area/testing Testing related kind/cleanup Something that is not needed anymore and can be cleaned up cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. labels Mar 7, 2025
@gardener-prow gardener-prow bot requested review from ary1992 and LucaBernstein March 7, 2025 10:17
@gardener-prow gardener-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 7, 2025
@tobschli tobschli force-pushed the seed-test-refactor branch from d8da11a to c00eea0 Compare March 7, 2025 14:40
@rfranzke rfranzke requested a review from LucaBernstein March 10, 2025 08:09
"sigs.k8s.io/controller-runtime/pkg/client"
)

// ObjectNames takes an ObjectList and returns a list of the objects within this list.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// ObjectNames takes an ObjectList and returns a list of the objects within this list.
// ObjectNames takes an ObjectList and returns the corresponding names of the objects.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to github.com/gardener/gardener/pkg/utils/test/matchers or github.com/gardener/gardener/pkg/utils/test?

Copy link
Member

@LucaBernstein LucaBernstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

besides the previous comments, lgtm

Copy link
Member

@timuthy timuthy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🙂
/lgtm

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Mar 10, 2025
Copy link
Contributor

gardener-prow bot commented Mar 10, 2025

LGTM label has been added.

Git tree hash: da114db5467f3ca1c3cdb7baf5f19e96f83cd13f

Copy link
Member

@LucaBernstein LucaBernstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@LucaBernstein
Copy link
Member

/approve

Copy link
Contributor

gardener-prow bot commented Mar 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LucaBernstein

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:

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

@gardener-prow gardener-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 10, 2025
@gardener-prow gardener-prow bot merged commit b48ded1 into gardener:master Mar 10, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/testing Testing related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/cleanup Something that is not needed anymore and can be cleaned up lgtm Indicates that a PR is ready to be merged. 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.

3 participants