Skip to content

test(package/thin/master.go): refactor tests to use Ginkgo#5475

Merged
RongGu merged 4 commits intofluid-cloudnative:masterfrom
hxrshxz:thin/master
Feb 5, 2026
Merged

test(package/thin/master.go): refactor tests to use Ginkgo#5475
RongGu merged 4 commits intofluid-cloudnative:masterfrom
hxrshxz:thin/master

Conversation

@hxrshxz
Copy link
Contributor

@hxrshxz hxrshxz commented Jan 23, 2026

Ⅰ. Describe what this PR does

Adds Ginkgo-based unit tests for thin package's master.go

Ⅱ. Does this pull request fix one issue?

part of #5407

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

  • CheckMasterReady: 2 test cases (daemonset exists, not found)
  • ShouldSetupMaster: 3 test cases (FusePhase None/Ready/NotReady)
  • SetupMaster: 1 test case (daemonset already exists)

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hxrshxz, 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 enhances the testing infrastructure for the thin DDC engine by migrating its unit tests to the Ginkgo framework. The changes introduce comprehensive test coverage for critical validation logic concerning dataset mounts and the master setup process, ensuring greater stability and correctness of these components. This refactoring improves the clarity and maintainability of the test suite, making future development and debugging more efficient.

Highlights

  • Test Refactoring: Refactored existing tests and introduced new ones for the validate.go and master.go files within the pkg/ddc/thin package to utilize the Ginkgo testing framework.
  • New Test Cases for Validation: Added 9 new test cases for validateDuplicateDatasetMounts covering scenarios like nil datasets, empty mounts, single/multiple unique mounts, duplicate names/paths, and conflicts between explicit and default paths. Also added 3 test cases for ThinEngine.Validate to check valid datasets, duplicate mount names, and nil runtimeInfo.
  • New Test Cases for Master Setup: Introduced 2 new test cases for ThinEngine.CheckMasterReady (daemonset existence), 3 for ThinEngine.ShouldSetupMaster (different Fuse phases), and 1 for ThinEngine.SetupMaster (daemonset already exists).
  • Issue Fix: This pull request addresses and fixes issue [FEATURES]Unify and Modernize Fluid’s Unit Testing Framework and Enhance Testing Coverage to 70% #5407.

🧠 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 Jan 23, 2026

Hi @hxrshxz. 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 introduces a comprehensive suite of Ginkgo-based unit tests for master.go and validate.go in the thin package, significantly improving test coverage. The test cases are well-structured and cover a wide range of scenarios.

My review includes suggestions to enhance test maintainability by refactoring repetitive test code into DescribeTable blocks. I've also identified a test case that is likely to cause a panic and provided a corrected version that more accurately tests the intended validation logic.

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.39%. Comparing base (6dd9555) to head (05bcfa2).
⚠️ Report is 66 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5475      +/-   ##
==========================================
+ Coverage   56.76%   59.39%   +2.62%     
==========================================
  Files         443      444       +1     
  Lines       30735    30540     -195     
==========================================
+ Hits        17447    18138     +691     
+ Misses      11734    10895     -839     
+ Partials     1554     1507      -47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hxrshxz hxrshxz force-pushed the thin/master branch 2 times, most recently from bf92396 to 628cc62 Compare January 23, 2026 06:43
@hxrshxz hxrshxz changed the title test(validate): refactor tests to use Ginkgo test(package/thin/master.go): refactor tests to use Ginkgo Jan 23, 2026
Signed-off-by: Harsh <harshmastic@gmail.com>
@hxrshxz
Copy link
Contributor Author

hxrshxz commented Jan 25, 2026

/gemini review

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 introduces Ginkgo-based unit tests for master.go in the thin package. The tests are well-structured and cover the main logic of CheckMasterReady and ShouldSetupMaster. I've identified an opportunity to improve the test coverage for the SetupMaster function by adding a test case for when the fuse daemonset does not initially exist. This will help ensure the creation logic is also validated.

Signed-off-by: Harsh <harshmastic@gmail.com>
Signed-off-by: Harsh <harshmastic@gmail.com>
Copilot AI review requested due to automatic review settings January 28, 2026 14:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates pkg/ddc/thin/master.go unit testing to a Ginkgo/Gomega style and ensures the Thin package’s Ginkgo specs are executed under the correct package.

Changes:

  • Switch thin_suite_test.go from thin_test to thin so Ginkgo specs in package thin run.
  • Add new Ginkgo-based tests for ThinEngine.CheckMasterReady, ThinEngine.ShouldSetupMaster, and ThinEngine.SetupMaster.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/ddc/thin/thin_suite_test.go Aligns the Ginkgo suite package with package thin so in-package Ginkgo specs are discoverable/executed.
pkg/ddc/thin/master_test.go Introduces Ginkgo/Gomega coverage for master.go behaviors (ready check, setup decision, and no-op setup when DS exists).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Harsh <harshmastic@gmail.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

@hxrshxz hxrshxz requested a review from cheyang February 3, 2026 08:52
Copy link
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Copy link
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Feb 5, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheyang

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

The pull request process is described 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

@RongGu RongGu merged commit fde8bc8 into fluid-cloudnative:master Feb 5, 2026
18 checks passed
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.

3 participants