test(ddc/goosefs): migrate api_gateway tests to ginkgo#5562
test(ddc/goosefs): migrate api_gateway tests to ginkgo#5562cheyang merged 2 commits intofluid-cloudnative:masterfrom
Conversation
Signed-off-by: Harsh <harshmastic@gmail.com>
Summary of ChangesHello @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 modernizes the unit testing infrastructure for the Highlights
🧠 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 AssistThe 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
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 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
|
|
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.
Code Review
The pull request successfully migrates the API gateway tests to use the Ginkgo/Gomega framework, which improves the test structure and readability. I've included a couple of minor suggestions to further enhance the clarity and consistency of the new test code.
| type testCase struct { | ||
| name string | ||
| engineName string | ||
| engineNamespace string | ||
| port int32 | ||
| wantEndpoint string | ||
| }{ | ||
| "test GetAPIGatewayStatus case 1": { | ||
| engineName: "fluid", | ||
| engineNamespace: "default", | ||
| port: 8080, | ||
| wantEndpoint: fmt.Sprintf(endpointFormat, "fluid", "default", 8080), | ||
| }, | ||
| "test GetAPIGatewayStatus case 2": { | ||
| engineName: "demo", | ||
| engineNamespace: common.NamespaceFluidSystem, | ||
| port: 80, | ||
| wantEndpoint: fmt.Sprintf(endpointFormat, "demo", common.NamespaceFluidSystem, 80), | ||
| }, | ||
| } |
There was a problem hiding this comment.
The name field in the testCase struct is defined but never used. The test descriptions are provided in the Entry functions. You can remove this field to simplify the struct. This will also require removing it from the testCase literals below.
type testCase struct {
engineName string
engineNamespace string
port int32
wantEndpoint string
}|
|
||
| Expect(err).NotTo(HaveOccurred()) | ||
| expectedStatus := &datav1alpha1.APIGatewayStatus{ | ||
| Endpoint: fmt.Sprintf(endpointFormat, tc.engineName, tc.engineNamespace, tc.port), |
There was a problem hiding this comment.
Pull request overview
This PR migrates unit tests in pkg/ddc/goosefs/api_gateway_test.go from standard Go testing with testify to the Ginkgo/Gomega BDD-style testing framework. This is part of a larger initiative (issue #5407) to modernize and unify Fluid's testing framework across the codebase.
Changes:
- Replaced standard Go testing imports with Ginkgo v2 and Gomega
- Converted two test functions (
TestGetAPIGatewayStatusandTestQueryAPIGatewayEndpoint) to Ginkgo'sDescribe/DescribeTable/Entrypattern - Refactored test cases from map-based iteration to table-driven tests using Ginkgo's DescribeTable
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| testCases := map[string]struct { | ||
|
|
||
| type testCase struct { | ||
| name string |
There was a problem hiding this comment.
The name field in the testCase struct is defined but never used in the test functions. Consider removing this field to keep the struct definition clean and avoid confusion.
| engineName string | ||
| engineNamespace string | ||
| port int32 | ||
| wantEndpoint string |
There was a problem hiding this comment.
The wantEndpoint field in the testCase struct is not used in the GetAPIGatewayStatus test (lines 72-103). It's only referenced in the queryAPIGatewayEndpoint test. Consider either removing this field from the testCase struct and computing the expected endpoint inline, or splitting into two separate structs for each test if they have different field requirements.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5562 +/- ##
==========================================
+ Coverage 58.33% 59.07% +0.74%
==========================================
Files 444 444
Lines 30431 30431
==========================================
+ Hits 17751 17978 +227
+ Misses 11188 10947 -241
- Partials 1492 1506 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Harsh <harshmastic@gmail.com>
|
|
[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 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/goosefs/api_gateway_test.goto use Ginkgo/Gomega framework.Ⅱ. 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/goosefs/... -count=1Ⅴ. Special notes for reviews
N/A