Skip to content

chore: bump up common k8s deps#2746

Merged
simar7 merged 10 commits intoaquasecurity:mainfrom
afdesk:chore/bump-some-deps
Sep 18, 2025
Merged

chore: bump up common k8s deps#2746
simar7 merged 10 commits intoaquasecurity:mainfrom
afdesk:chore/bump-some-deps

Conversation

@afdesk
Copy link
Contributor

@afdesk afdesk commented Sep 15, 2025

Description

In controller-runtime version v0.22+, several breaking changes were introduced that affected our test setup:

  • Fake client no longer supports objects with pointer ObjectMeta, and it clears TypeMeta for structured objects:

As a result, some of our existing test data became incompatible.

This PR addresses these issues by:

  • Removing TypeMeta from test fixtures.
  • Updating report type resolution: since the fake client may no longer set GVK on Get, we now rely on the Go type instead of GVK to determine the report type.

Additionally, due to the breaking changes, the hash of the test resources has also been affected. To make the tests more resilient, the hash value is no longer hardcoded as a constant but is now computed dynamically.

It fixes fails in #2749

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@github-actions github-actions bot added the misc label Sep 15, 2025
@afdesk afdesk marked this pull request as ready for review September 15, 2025 07:23
@afdesk afdesk requested a review from simar7 as a code owner September 15, 2025 07:23
Comment on lines +110 to +115
specHash := kube.ComputeHash(corev1.PodSpec{
Containers: []corev1.Container{{
Name: "nginx",
Image: "nginx:1.16",
}},
})
Copy link
Member

Choose a reason for hiding this comment

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

While this makes the tests resilient like you mentioned, it also allows the tests to silently pass, even if there's an actual problem because the hash will never be statically defined and always get computed on the fly.

I think it's better to have the hash statically defined, similar to a static golden file. If the tests break and we have to update them often, we should re-think what we are asserting as unit tests for the most part should offer resilience across code changes.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it makes sense!
done 5bc396b

@afdesk afdesk requested a review from simar7 September 17, 2025 08:50
@simar7 simar7 merged commit b9972b4 into aquasecurity:main Sep 18, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants