-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Migrate (pkg/ddc/thin/worker_test.go) tests to use Ginkgo #5539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Harsh <harshmastic@gmail.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/gemini review |
1 similar comment
|
/gemini review |
|
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
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
There was a problem hiding this 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.Ttests with GinkgoDescribe/Itspecs for worker-related behaviors. - Updated assertions to Gomega
Expectstyle. - Adjusted imports/scheme setup to support the new test style.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var _ = Describe("ThinEngine_ShouldSetupWorkers", func() { | ||
| It("should return true when worker phase is None and worker is enabled", func() { | ||
| runtime := &datav1alpha1.ThinRuntime{ |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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.
| Namespace: "fluid", | ||
| }, | ||
| Spec: datav1alpha1.ThinRuntimeSpec{ | ||
| Replicas: 1, |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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.
| Replicas: 1, | |
| Replicas: 1, | |
| Worker: datav1alpha1.ThinCompTemplateSpec{ | |
| Enabled: true, | |
| }, |
| err = e.SetupWorkers() | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| Expect(*worker.Spec.Replicas).To(Equal(int32(1))) | ||
| }) |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Signed-off-by: Harsh <harshmastic@gmail.com>
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>
cheyang
left a comment
There was a problem hiding this 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.
|
putting in draft will fix soon |
161897a to
5c26c46
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|



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