Skip to content

Conversation

@hxrshxz
Copy link
Contributor

@hxrshxz hxrshxz commented Jan 28, 2026

Ⅰ. Describe what this PR does

Migrate unit tests in pkg/ddc/thin/worker_test.go to use Ginkgo/Gomega.

Ⅱ. Does this pull request fix one issue?

part of #5407

Ⅲ. List the added test cases

No new test cases. Migrated existing tests to Ginkgo/Gomega.

Ⅳ. Describe how to verify it

go test -v ./pkg/ddc/thin/... -count=1

Ⅴ. Special notes for reviews

N/A

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

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@hxrshxz
Copy link
Contributor Author

hxrshxz commented Jan 28, 2026

/gemini review

1 similar comment
@hxrshxz
Copy link
Contributor Author

hxrshxz commented Jan 28, 2026

/gemini review

@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

1 similar comment
@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Jan 28, 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

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

Migrates pkg/ddc/thin/worker_test.go unit tests from Go’s testing package style to Ginkgo/Gomega.

Changes:

  • Replaced table-driven testing.T tests with Ginkgo Describe/It specs for worker-related behaviors.
  • Updated assertions to Gomega Expect style.
  • Adjusted imports/scheme setup to support the new test style.

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

Comment on lines +35 to +37
var _ = Describe("ThinEngine_ShouldSetupWorkers", func() {
It("should return true when worker phase is None and worker is enabled", func() {
runtime := &datav1alpha1.ThinRuntime{
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

These are Ginkgo specs in package thin, but the only suite runner in this directory is pkg/ddc/thin/thin_suite_test.go which is declared as package thin_test. With go test, specs in package thin won't be executed unless there is a RunSpecs test in the same package. Please add/update a suite file in package thin (or move these specs to package thin_test and adjust access) so these tests actually run.

Copilot uses AI. Check for mistakes.
Namespace: "fluid",
},
Spec: datav1alpha1.ThinRuntimeSpec{
Replicas: 1,
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

SetupWorkers() short-circuits when t.runtime.Spec.Worker.Enabled is false (ThinEngine.isWorkerEnable()). In this test, runtime.Spec.Worker.Enabled is never set, so the test currently exercises the no-op path and doesn't validate worker setup behavior. Set runtime.Spec.Worker.Enabled = true (and any other required runtime fields) so the test actually covers SetupWorkers logic.

Suggested change
Replicas: 1,
Replicas: 1,
Worker: datav1alpha1.ThinCompTemplateSpec{
Enabled: true,
},

Copilot uses AI. Check for mistakes.
Comment on lines 303 to 306
err = e.SetupWorkers()
Expect(err).NotTo(HaveOccurred())
Expect(*worker.Spec.Replicas).To(Equal(int32(1)))
})
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The assertion Expect(*worker.Spec.Replicas)... checks the local worker variable, but SetupWorkers() will update the StatefulSet stored in the fake client, not this local value (you passed worker.DeepCopy() into the client). This makes the test pass even if scaling never happens. Fetch the StatefulSet back from mockClient after SetupWorkers() and assert on the retrieved object's fields; similarly, re-add any removed assertions (e.g., node label updates) that the previous table-driven test covered.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.29%. Comparing base (a011407) to head (161897a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5539   +/-   ##
=======================================
  Coverage   61.29%   61.29%           
=======================================
  Files         444      444           
  Lines       30540    30540           
=======================================
  Hits        18718    18718           
  Misses      10280    10280           
  Partials     1542     1542           

☔ 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>
Restores pkg/ddc/base/base_suite_test.go and runtime_conventions_test.go
to their upstream versions. These files should remain as package base_test
(external test package) to avoid conflicts with existing tests.

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

Please fix the conflict issue.

@hxrshxz hxrshxz requested a review from cheyang February 10, 2026 07:18
@hxrshxz hxrshxz marked this pull request as draft February 10, 2026 07:18
@hxrshxz
Copy link
Contributor Author

hxrshxz commented Feb 10, 2026

putting in draft will fix soon

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Feb 10, 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

@sonarqubecloud
Copy link

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.

2 participants