Skip to content

test: add Ginkgo/Gomega coverage for pkg/ddc/base #5803

Merged
fluid-e2e-bot[bot] merged 4 commits into
fluid-cloudnative:masterfrom
hxrshxz:test/ddc-base-file-scope-5676
May 14, 2026
Merged

test: add Ginkgo/Gomega coverage for pkg/ddc/base #5803
fluid-e2e-bot[bot] merged 4 commits into
fluid-cloudnative:masterfrom
hxrshxz:test/ddc-base-file-scope-5676

Conversation

@hxrshxz

@hxrshxz hxrshxz commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Ⅰ. Describe what this PR does

Add Ginkgo/Gomega test coverage for the file-scoped pkg/ddc/base dataset, engine, setup, and volume paths.

Ⅱ. Does this pull request fix one issue?

fixes #5676

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

  • migrate dataset helper tests in pkg/ddc/base/dataset_test.go to Ginkgo/Gomega
  • add setup-path coverage in pkg/ddc/base/dataset_setup_volume_test.go
  • add volume delegation and error-propagation specs in pkg/ddc/base/dataset_setup_volume_test.go
  • add owner dataset UID parsing coverage

Ⅳ. Describe how to verify it

  • go test ./pkg/ddc/base/...

Ⅴ. Special notes for reviews

N/A

Copilot AI review requested due to automatic review settings April 23, 2026 11:11
@fluid-e2e-bot

fluid-e2e-bot Bot commented Apr 23, 2026

Copy link
Copy Markdown

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 expands unit test coverage for the pkg/ddc/base dataset/setup/volume workflow by migrating tests to Ginkgo/Gomega, and it tightens TemplateEngine.Setup behavior so errors during runtime-status updates or dataset binding correctly report ready=false to the controller reconciliation loop.

Changes:

  • Fix TemplateEngine.Setup to return ready=false when CheckAndUpdateRuntimeStatus or BindToDataset fails.
  • Migrate dataset_test.go from testing/testify-style to Ginkgo/Gomega table-driven specs.
  • Add new Ginkgo/Gomega specs covering setup error paths and volume operation delegation/error propagation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
pkg/ddc/base/setup.go Adjusts error returns in Setup so failures can’t be misinterpreted as “ready”.
pkg/ddc/base/dataset_test.go Migrates dataset helper tests to Ginkgo/Gomega and strengthens assertions.
pkg/ddc/base/dataset_setup_volume_test.go Adds new specs for setup error handling and Create/DeleteVolume delegation.

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

Comment thread pkg/ddc/base/dataset_setup_volume_test.go
Comment thread pkg/ddc/base/dataset_setup_volume_test.go
Comment thread pkg/ddc/base/dataset_setup_volume_test.go
Comment thread pkg/ddc/base/dataset_setup_volume_test.go

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

Copy link
Copy Markdown
Contributor

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 refactors the dataset test suite to use the Ginkgo and Gomega frameworks and adds comprehensive tests for the TemplateEngine. It also fixes a bug in the Setup function where the return value was incorrectly handled during error states. Review feedback suggests cleaning up an unused constant and an empty test block, and adopting best practices for context keys by using custom types instead of raw strings.

Comment thread pkg/ddc/base/dataset_setup_volume_test.go
Comment thread pkg/ddc/base/dataset_setup_volume_test.go Outdated
Comment thread pkg/ddc/base/dataset_setup_volume_test.go Outdated
@codecov

codecov Bot commented Apr 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.22%. Comparing base (d14dcc7) to head (9643034).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5803      +/-   ##
==========================================
+ Coverage   59.10%   59.22%   +0.11%     
==========================================
  Files         480      480              
  Lines       32512    32512              
==========================================
+ Hits        19215    19254      +39     
+ Misses      11747    11715      -32     
+ Partials     1550     1543       -7     

☔ 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 commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 new test suite for TemplateEngine setup and volume operations and refactors existing dataset tests to use the Ginkgo and Gomega frameworks. It also corrects the error return logic in the Setup function to ensure a false status is returned upon failure. Review feedback recommends removing an unused constant and an empty test block to improve code cleanliness.

Comment thread pkg/ddc/base/dataset_setup_volume_test.go
Comment thread pkg/ddc/base/dataset_setup_volume_test.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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


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

@hxrshxz hxrshxz changed the title test: migrate pkg/ddc/base dataset coverage and tighten setup error handling test: add Ginkgo/Gomega coverage for pkg/ddc/base dataset paths Apr 23, 2026
@hxrshxz hxrshxz changed the title test: add Ginkgo/Gomega coverage for pkg/ddc/base dataset paths test: add Ginkgo/Gomega coverage for pkg/ddc/base Apr 23, 2026

@cheyang cheyang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

感谢贡献!stubImplement 模式设计灵活,能覆盖多种 Setup 路径。建议:

  1. stubImplement 中未覆盖的接口方法默认返回 nil/false,请确认这些默认返回值不会让测试产生误导性通过(如 CheckMasterReady 默认返回 false 可能导致提前终止)。
  2. 建议补充 CreateVolume/DeleteVolume 错误路径的测试。

cheyang

This comment was marked as duplicate.

@cheyang

This comment has been minimized.

@cheyang

cheyang commented May 8, 2026

Copy link
Copy Markdown
Collaborator

English translation of the previous review comments:

  1. In stubImplement, unimplemented interface methods default to returning nil/false. Please confirm these default returns don't produce misleading test passes (e.g., CheckMasterReady returning false by default could cause early termination).
  2. It's recommended to add test coverage for CreateVolume/DeleteVolume error paths.

hxrshxz added 4 commits May 11, 2026 06:41
Signed-off-by: Harsh <harshmastic@gmail.com>
Signed-off-by: Harsh <harshmastic@gmail.com>
Signed-off-by: Harsh <harshmastic@gmail.com>
Signed-off-by: Harsh <harshmastic@gmail.com>
@hxrshxz hxrshxz force-pushed the test/ddc-base-file-scope-5676 branch from b1ce4af to 9643034 Compare May 11, 2026 01:12
@sonarqubecloud

Copy link
Copy Markdown

@hxrshxz

hxrshxz commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed the stubImplement defaults are safe for these specs because each test sets the callbacks needed for the path under test; defaults such as CheckMasterReady=false only apply where the test is intentionally not exercising readiness progression.

I also added coverage for CreateVolume and DeleteVolume error propagation paths in the ddc/base specs.

@cheyang cheyang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm

@fluid-e2e-bot

fluid-e2e-bot Bot commented May 14, 2026

Copy link
Copy Markdown

[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

@fluid-e2e-bot fluid-e2e-bot Bot merged commit 6be1d4a into fluid-cloudnative:master May 14, 2026
18 checks passed
@cheyang

cheyang commented May 14, 2026

Copy link
Copy Markdown
Collaborator

/approve

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.

Unify and Modernize Fluid’s Unit Testing Framework and Enhance Testing Coverage

3 participants