Skip to content

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

Open
hxrshxz wants to merge 3 commits intofluid-cloudnative:masterfrom
hxrshxz:test/ddc-base-file-scope-5676
Open

test: add Ginkgo/Gomega coverage for pkg/ddc/base #5803
hxrshxz wants to merge 3 commits intofluid-cloudnative:masterfrom
hxrshxz:test/ddc-base-file-scope-5676

Conversation

@hxrshxz
Copy link
Copy Markdown
Contributor

@hxrshxz hxrshxz commented Apr 23, 2026

Ⅰ. 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

Signed-off-by: Harsh <harshmastic@gmail.com>
Copilot AI review requested due to automatic review settings April 23, 2026 11:11
@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot Bot commented Apr 23, 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

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot Bot commented Apr 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
Copy Markdown
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 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
Copy link
Copy Markdown
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 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
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.27%. Comparing base (6df6421) to head (b00054f).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5803      +/-   ##
==========================================
- Coverage   58.51%   58.27%   -0.24%     
==========================================
  Files         473      478       +5     
  Lines       32283    32485     +202     
==========================================
+ Hits        18890    18931      +41     
- Misses      11849    12015     +166     
+ Partials     1544     1539       -5     

☔ 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.

Signed-off-by: Harsh <harshmastic@gmail.com>
@hxrshxz
Copy link
Copy Markdown
Contributor Author

hxrshxz commented Apr 23, 2026

/gemini review

Copy link
Copy Markdown
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 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
Copy link
Copy Markdown
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

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
Signed-off-by: Harsh <harshmastic@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

@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
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

2 participants