Skip to content

Conversation

@Popie52
Copy link

@Popie52 Popie52 commented Feb 1, 2026

Ⅰ. Describe what this PR does

This PR adds a Ginkgo/Gomega-based unit test suite for the MountPropagationInjector webhook plugin.

The existing unit test was implemented using the standard testing.T style and relied on an uninitialized Kubernetes client. This PR refactors the test into a BDD-style Ginkgo/Gomega suite and initializes a proper fake controller-runtime client, making the test behavior safer, clearer, and more representative of real execution paths.

No production code is modified; the change is limited strictly to test code.


Ⅱ. Does this pull request fix one issue?

fixes #5407


Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Added unit tests (Ginkgo/Gomega):

  • Verifies the plugin reports the correct name
  • Ensures mutation does not stop when valid runtimeInfo exists
  • Ensures mutation succeeds when runtimeInfos is empty
  • Ensures mutation returns an error when runtimeInfo is nil

These tests replace the previous testing.T-based test with equivalent coverage and improved structure.


Ⅳ. Describe how to verify it

Run the following command:

go test ./pkg/webhook/plugins/mountpropagationinjector -v

The test suite should pass successfully without panics or nil-client issues.

Ⅴ. Special notes for reviews

This PR is intentionally scoped as a small, isolated step toward the broader test framework unification effort (Testify / testing.T → Ginkgo/Gomega) discussed in issue #5407.

It demonstrates:

Safe use of controller-runtime fake clients

Coexistence of Ginkgo/Gomega with existing test infrastructure

Improved test readability and structure without impacting production logic

Signed-off-by: Popie52 <popiesailor@gmail.com>
Signed-off-by: Popie52 <popiesailor@gmail.com>
Signed-off-by: Popie52 <popiesailor@gmail.com>
Signed-off-by: Popie52 <popiesailor@gmail.com>
@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Feb 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cheyang for approval by writing /assign @cheyang in a comment. For more information see:The Kubernetes 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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Popie52, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the unit testing framework for the MountPropagationInjector webhook plugin by migrating its tests from the standard testing.T package to a BDD-style suite using Ginkgo and Gomega. This refactoring improves test readability, reliability, and maintainability by utilizing a properly initialized fake Kubernetes client, ensuring more robust and representative test scenarios without altering any production code.

Highlights

  • Ginkgo/Gomega Adoption: Introduces Ginkgo/Gomega unit tests for the MountPropagationInjector webhook plugin, replacing the previous testing.T-style test.
  • Improved Test Client: Refactors tests to use a proper fake controller-runtime client, enhancing test safety, clarity, and realism.
  • New Test Cases: Adds specific BDD-style tests for MountPropagationInjector covering plugin naming, mutation behavior with and without runtimeInfo, and error handling for nil runtimeInfo.
  • No Production Code Impact: Confirms that all changes are confined to test code, with no modifications to production logic.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Feb 1, 2026

Hi @Popie52. Thanks for your PR.

I'm waiting for a fluid-cloudnative 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/test-infra repository.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively refactors the unit tests for MountPropagationInjector and FuseSidecar webhook plugins to use Ginkgo/Gomega, which improves readability and structure. The use of a fake controller-runtime client is a significant improvement over the previous nil client, making the tests safer and more realistic.

My review includes suggestions to enhance the test coverage for both plugins to ensure their core mutation logic is actually being tested, which is currently not the case as the test pods lack the necessary volume mounts to trigger the injection logic.

Popie52 and others added 2 commits February 1, 2026 20:03
…gation injection

Signed-off-by: Popie52 <popiesailor@gmail.com>
Signed-off-by: Popie52 <popiesailor@gmail.com>
@Popie52 Popie52 force-pushed the mountpropagation-ginkgo branch from fa1b555 to 5d0d568 Compare February 2, 2026 03:25
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 2, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURES]Unify and Modernize Fluid’s Unit Testing Framework and Enhance Testing Coverage to 70%

1 participant