Skip to content

test(api/v1alpha1): add data operation type coverage#5890

Open
hxrshxz wants to merge 11 commits into
fluid-cloudnative:masterfrom
hxrshxz:test/api-v1alpha1-dataops-ginkgo
Open

test(api/v1alpha1): add data operation type coverage#5890
hxrshxz wants to merge 11 commits into
fluid-cloudnative:masterfrom
hxrshxz:test/api-v1alpha1-dataops-ginkgo

Conversation

@hxrshxz
Copy link
Copy Markdown
Contributor

@hxrshxz hxrshxz commented May 17, 2026

Ⅰ. Describe what this PR does

Add Ginkgo/Gomega coverage for the api/v1alpha1 data operation API types, including registration, DeepCopyObject sanity, and representative spec/status construction.

Ⅱ. Does this pull request fix one issue?

#5676

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

  • Added DataLoad type tests for GVK registration, DeepCopyObject, and representative spec/status construction
  • Added DataMigrate type tests for GVK registration, DeepCopyObject, and representative spec/status construction
  • Added DataBackup type tests for GVK registration, DeepCopyObject, and representative spec/status construction
  • Added DataProcess type tests for GVK registration, DeepCopyObject, and representative spec/status construction

Ⅳ. Describe how to verify it

Run the api/v1alpha1 Go test package and confirm the new Ginkgo specs pass for the data operation API types.

Ⅴ. Special notes for reviews

This PR is stacked after #5889 because that PR adds the shared api/v1alpha1 suite_test.go bootstrap; the upstream base branch for #5889 was not available as a direct PR base target, so this PR targets master and should be reviewed after #5889.

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

fluid-e2e-bot Bot commented May 17, 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 May 17, 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

Migrates and expands api/v1alpha1 unit tests to Ginkgo v2 + Gomega, adding scheme registration, DeepCopyObject, and spec/status construction coverage for the four data operation types (DataLoad, DataMigrate, DataBackup, DataProcess). Part of the broader Ginkgo/Gomega migration tracked in #5676 and stacked on #5889.

Changes:

  • Adds new Ginkgo specs for DataLoad/DataMigrate/DataBackup/DataProcess covering scheme GVKs, deep-copy semantics, and representative spec/status structures.
  • Re-converts existing dataset_types_test.go and container_network_test.go into Ginkgo DescribeTable style and introduces a shared apiGVKFor helper using UnitTestScheme.
  • Adds the v1alpha1 Ginkgo suite bootstrap and a common_test.go Ginkgo suite for MetadataSyncPolicy.AutoSyncEnabled, Dataset.CanbeBound, and Dataset.IsExclusiveMode.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
api/v1alpha1/suite_test.go New Ginkgo test entrypoint for the v1alpha1 package suite.
api/v1alpha1/common_test.go Ginkgo coverage for MetadataSyncPolicy.AutoSyncEnabled, Dataset.CanbeBound, Dataset.IsExclusiveMode.
api/v1alpha1/container_network_test.go Migrates IsHostNetwork table test to DescribeTable.
api/v1alpha1/dataset_types_test.go Migrates Set/RemoveDataOperationInProgress tests to Ginkgo DescribeTable.
api/v1alpha1/dataload_types_test.go New tests for DataLoad GVK registration, DeepCopyObject, and spec/status construction; defines shared apiGVKFor helper.
api/v1alpha1/databackup_types_test.go New tests for DataBackup GVK registration, DeepCopyObject, and spec/status construction.
api/v1alpha1/datamigrate_types_test.go New tests for DataMigrate GVK registration, DeepCopyObject, and spec/status construction.
api/v1alpha1/dataprocess_types_test.go New tests for DataProcess GVK registration, DeepCopyObject, and spec/status construction.

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

Comment thread api/v1alpha1/common_test.go Outdated
Comment on lines +5 to +15
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
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 existing tests and introduces new unit tests for the v1alpha1 API package using the Ginkgo and Gomega frameworks, covering data operations such as DataBackup, DataLoad, DataMigrate, and DataProcess. The reviewer suggests improving test organization by moving Dataset-specific tests and shared helpers to centralized locations. Additionally, feedback was provided to enhance DeepCopyObject tests by explicitly verifying that nested pointers are deep-copied to ensure object independence.

Comment thread api/v1alpha1/common_test.go Outdated
Comment on lines +48 to +81
Describe("Dataset.CanbeBound", func() {
It("returns true when no runtime is recorded", func() {
dataset := &Dataset{}

Expect(dataset.CanbeBound("runtime", "fluid", common.AccelerateCategory)).To(BeTrue())
})

It("returns true only for a matching runtime identity", func() {
dataset := &Dataset{
Status: DatasetStatus{
Runtimes: []Runtime{
{Name: "target", Namespace: "fluid", Category: common.AccelerateCategory},
},
},
}

Expect(dataset.CanbeBound("target", "fluid", common.AccelerateCategory)).To(BeTrue())
Expect(dataset.CanbeBound("other", "fluid", common.AccelerateCategory)).To(BeFalse())
})
})

Describe("Dataset.IsExclusiveMode", func() {
It("treats default placement as exclusive", func() {
dataset := &Dataset{}

Expect(dataset.IsExclusiveMode()).To(BeTrue())
})

It("returns false for shared placement mode", func() {
dataset := &Dataset{Spec: DatasetSpec{PlacementMode: ShareMode}}

Expect(dataset.IsExclusiveMode()).To(BeFalse())
})
})
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.

medium

The tests for Dataset.CanbeBound and Dataset.IsExclusiveMode are better suited for api/v1alpha1/dataset_types_test.go, which already contains tests for other Dataset methods. This keeps common_test.go focused on the types defined in common.go (like MetadataSyncPolicy).

Comment on lines +58 to +63
copiedObject := dataBackup.DeepCopyObject()
copiedDataBackup, ok := copiedObject.(*DataBackup)
Expect(ok).To(BeTrue())
Expect(copiedDataBackup).NotTo(BeIdenticalTo(dataBackup))
Expect(copiedDataBackup.Spec).To(Equal(dataBackup.Spec))
Expect(copiedDataBackup.Status).To(Equal(dataBackup.Status))
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.

medium

The DeepCopyObject test should verify that nested pointers are actually deep-copied. Currently, it only checks value equality using Equal (which uses reflect.DeepEqual), which doesn't distinguish between shallow and deep copies of pointer fields like Spec.RunAs and Spec.RunAfter. To ensure independence of the copy, you should verify that these pointers point to different memory addresses.

Suggested change
copiedObject := dataBackup.DeepCopyObject()
copiedDataBackup, ok := copiedObject.(*DataBackup)
Expect(ok).To(BeTrue())
Expect(copiedDataBackup).NotTo(BeIdenticalTo(dataBackup))
Expect(copiedDataBackup.Spec).To(Equal(dataBackup.Spec))
Expect(copiedDataBackup.Status).To(Equal(dataBackup.Status))
copiedObject := dataBackup.DeepCopyObject()
copiedDataBackup, ok := copiedObject.(*DataBackup)
Expect(ok).To(BeTrue())
Expect(copiedDataBackup).NotTo(BeIdenticalTo(dataBackup))
Expect(copiedDataBackup.Spec).To(Equal(dataBackup.Spec))
// Verify deep copy of nested pointers
if dataBackup.Spec.RunAs != nil {
Expect(copiedDataBackup.Spec.RunAs).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs))
}
if dataBackup.Spec.RunAfter != nil {
Expect(copiedDataBackup.Spec.RunAfter).NotTo(BeIdenticalTo(dataBackup.Spec.RunAfter))
}
Expect(copiedDataBackup.Status).To(Equal(dataBackup.Status))

Comment on lines +55 to +60
copiedObject := dataLoad.DeepCopyObject()
copiedDataLoad, ok := copiedObject.(*DataLoad)
Expect(ok).To(BeTrue())
Expect(copiedDataLoad).NotTo(BeIdenticalTo(dataLoad))
Expect(copiedDataLoad.Spec).To(Equal(dataLoad.Spec))
Expect(copiedDataLoad.Status).To(Equal(dataLoad.Status))
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.

medium

Similar to other DeepCopyObject tests, this should verify that nested pointers (like Spec.RunAfter) are deep-copied to ensure that the copy is independent of the original object.

Suggested change
copiedObject := dataLoad.DeepCopyObject()
copiedDataLoad, ok := copiedObject.(*DataLoad)
Expect(ok).To(BeTrue())
Expect(copiedDataLoad).NotTo(BeIdenticalTo(dataLoad))
Expect(copiedDataLoad.Spec).To(Equal(dataLoad.Spec))
Expect(copiedDataLoad.Status).To(Equal(dataLoad.Status))
copiedObject := dataLoad.DeepCopyObject()
copiedDataLoad, ok := copiedObject.(*DataLoad)
Expect(ok).To(BeTrue())
Expect(copiedDataLoad).NotTo(BeIdenticalTo(dataLoad))
Expect(copiedDataLoad.Spec).To(Equal(dataLoad.Spec))
// Verify deep copy of nested pointers
if dataLoad.Spec.RunAfter != nil {
Expect(copiedDataLoad.Spec.RunAfter).NotTo(BeIdenticalTo(dataLoad.Spec.RunAfter))
}
Expect(copiedDataLoad.Status).To(Equal(dataLoad.Status))

Comment thread api/v1alpha1/dataload_types_test.go Outdated
})
})

func apiGVKFor(object runtime.Object) (schema.GroupVersionKind, error) {
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.

medium

The apiGVKFor helper function is used by multiple test files in this package (databackup_types_test.go, datamigrate_types_test.go, etc.). Consider moving it to suite_test.go to centralize shared test utilities and improve code organization.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.65%. Comparing base (ed9b7ef) to head (806f1ed).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5890   +/-   ##
=======================================
  Coverage   61.65%   61.65%           
=======================================
  Files         480      480           
  Lines       32613    32613           
=======================================
  Hits        20108    20108           
  Misses      10897    10897           
  Partials     1608     1608           

☔ 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 hxrshxz force-pushed the test/api-v1alpha1-dataops-ginkgo branch from d1da84f to 1c55f9b Compare May 17, 2026 11:06
@hxrshxz hxrshxz requested a review from Copilot May 17, 2026 11:51
@hxrshxz
Copy link
Copy Markdown
Contributor Author

hxrshxz commented May 17, 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 migrates the v1alpha1 API unit tests to the Ginkgo and Gomega testing frameworks and introduces comprehensive test coverage for several API types, including DataBackup, DataLoad, DataMigrate, and DataProcess. The new tests cover scheme registration, DeepCopyObject functionality, and spec/status construction. Feedback was provided to strengthen the DeepCopyObject tests for DataMigrate and DataProcess by explicitly verifying that nested pointers are deep-copied rather than just comparing their values.

Comment on lines +60 to +61
Expect(copiedDataMigrate.Spec.From).To(Equal(dataMigrate.Spec.From))
Expect(copiedDataMigrate.Spec.To).To(Equal(dataMigrate.Spec.To))
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.

medium

The DeepCopyObject test for DataMigrate should verify that the copy is truly deep by ensuring that nested pointers (such as DataSet and ExternalStorage) are not identical to the original pointers. Currently, it only verifies value equality, which would pass even for a shallow copy of the pointers.

Suggested change
Expect(copiedDataMigrate.Spec.From).To(Equal(dataMigrate.Spec.From))
Expect(copiedDataMigrate.Spec.To).To(Equal(dataMigrate.Spec.To))
Expect(copiedDataMigrate.Spec.From).To(Equal(dataMigrate.Spec.From))
if dataMigrate.Spec.From.DataSet != nil {
Expect(copiedDataMigrate.Spec.From.DataSet).NotTo(BeIdenticalTo(dataMigrate.Spec.From.DataSet))
}
Expect(copiedDataMigrate.Spec.To).To(Equal(dataMigrate.Spec.To))
if dataMigrate.Spec.To.ExternalStorage != nil {
Expect(copiedDataMigrate.Spec.To.ExternalStorage).NotTo(BeIdenticalTo(dataMigrate.Spec.To.ExternalStorage))
}

Comment thread api/v1alpha1/dataprocess_types_test.go Outdated
Comment on lines +66 to +67
Expect(copiedDataProcess.Spec.Processor.Script).NotTo(BeNil())
Expect(*copiedDataProcess.Spec.Processor.Script).To(Equal(*dataProcess.Spec.Processor.Script))
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.

medium

To properly validate the DeepCopyObject implementation for DataProcess, the test should verify that the Processor.Script pointer in the copied object is not identical to the one in the original object. This ensures that a deep copy was performed rather than a shallow one, maintaining consistency with the other data operation tests in this pull request.

Suggested change
Expect(copiedDataProcess.Spec.Processor.Script).NotTo(BeNil())
Expect(*copiedDataProcess.Spec.Processor.Script).To(Equal(*dataProcess.Spec.Processor.Script))
Expect(copiedDataProcess.Spec.Processor.Script).NotTo(BeNil())
Expect(copiedDataProcess.Spec.Processor.Script).NotTo(BeIdenticalTo(dataProcess.Spec.Processor.Script))
Expect(copiedDataProcess.Spec.Processor.Script).To(Equal(dataProcess.Spec.Processor.Script))

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 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread api/v1alpha1/common_test.go Outdated
@@ -0,0 +1,47 @@
/*
Copyright 2020 The Fluid Authors.
Signed-off-by: Harsh <harshmastic@gmail.com>
@hxrshxz hxrshxz force-pushed the test/api-v1alpha1-dataops-ginkgo branch from 1bd8382 to b1600b2 Compare May 17, 2026 11:55
@hxrshxz
Copy link
Copy Markdown
Contributor Author

hxrshxz commented May 17, 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 migrates the v1alpha1 API unit tests to the Ginkgo and Gomega frameworks, adding new tests for DataBackup, DataLoad, DataMigrate, and DataProcess types. The changes cover scheme registration, deep copy logic, and object construction. The review feedback identifies opportunities to simplify the test code by removing redundant nil checks and suggests strengthening the deep copy verification by ensuring nested pointers are distinct memory addresses.

Comment thread api/v1alpha1/databackup_types_test.go Outdated
Comment on lines +64 to +78
if dataBackup.Spec.RunAs != nil {
Expect(copiedDataBackup.Spec.RunAs).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs))
}
if dataBackup.Spec.RunAfter != nil {
Expect(copiedDataBackup.Spec.RunAfter).NotTo(BeIdenticalTo(dataBackup.Spec.RunAfter))
}
Expect(copiedDataBackup.Status).To(Equal(dataBackup.Status))
if dataBackup.Spec.RunAs != nil {
if dataBackup.Spec.RunAs.UID != nil {
Expect(copiedDataBackup.Spec.RunAs.UID).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs.UID))
}
if dataBackup.Spec.RunAs.GID != nil {
Expect(copiedDataBackup.Spec.RunAs.GID).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs.GID))
}
}
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.

medium

These if checks are redundant because the dataBackup object is explicitly initialized with these fields (RunAs, RunAfter, UID, GID) being non-nil in the test setup above. Removing the conditionals makes the test code cleaner and more direct.

Suggested change
if dataBackup.Spec.RunAs != nil {
Expect(copiedDataBackup.Spec.RunAs).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs))
}
if dataBackup.Spec.RunAfter != nil {
Expect(copiedDataBackup.Spec.RunAfter).NotTo(BeIdenticalTo(dataBackup.Spec.RunAfter))
}
Expect(copiedDataBackup.Status).To(Equal(dataBackup.Status))
if dataBackup.Spec.RunAs != nil {
if dataBackup.Spec.RunAs.UID != nil {
Expect(copiedDataBackup.Spec.RunAs.UID).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs.UID))
}
if dataBackup.Spec.RunAs.GID != nil {
Expect(copiedDataBackup.Spec.RunAs.GID).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs.GID))
}
}
// Verify deep copy of nested pointers.
Expect(copiedDataBackup.Spec.RunAs).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs))
Expect(copiedDataBackup.Spec.RunAfter).NotTo(BeIdenticalTo(dataBackup.Spec.RunAfter))
Expect(copiedDataBackup.Status).To(Equal(dataBackup.Status))
Expect(copiedDataBackup.Spec.RunAs.UID).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs.UID))
Expect(copiedDataBackup.Spec.RunAs.GID).NotTo(BeIdenticalTo(dataBackup.Spec.RunAs.GID))

Comment thread api/v1alpha1/dataload_types_test.go Outdated
Comment on lines +63 to +67
if dataLoad.Spec.RunAfter != nil {
Expect(copiedDataLoad.Spec.RunAfter).NotTo(BeIdenticalTo(dataLoad.Spec.RunAfter))
dataLoad.Spec.RunAfter.Name = "changed-after-copy"
Expect(copiedDataLoad.Spec.RunAfter.ObjectRef).To(Equal(ObjectRef{Kind: "DataLoad", Name: "prepare"}))
}
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.

medium

The if check for RunAfter is unnecessary here as it is guaranteed to be non-nil by the test setup on line 48. Simplifying the test by removing the conditional improves readability.

			// Verify deep copy of nested pointers.
			Expect(copiedDataLoad.Spec.RunAfter).NotTo(BeIdenticalTo(dataLoad.Spec.RunAfter))
			dataLoad.Spec.RunAfter.Name = "changed-after-copy"
			Expect(copiedDataLoad.Spec.RunAfter.ObjectRef).To(Equal(ObjectRef{Kind: "DataLoad", Name: "prepare"}))

Comment on lines +60 to +62
Expect(copiedDataMigrate.Spec.From).To(Equal(dataMigrate.Spec.From))
Expect(copiedDataMigrate.Spec.To).To(Equal(dataMigrate.Spec.To))
Expect(copiedDataMigrate.Status).To(Equal(dataMigrate.Status))
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.

medium

The DeepCopyObject test should also verify that nested pointers (like DataSet and ExternalStorage) are actually deep-copied by checking that they point to different memory addresses. Currently, it only verifies value equality, which would also pass for a shallow copy.

Suggested change
Expect(copiedDataMigrate.Spec.From).To(Equal(dataMigrate.Spec.From))
Expect(copiedDataMigrate.Spec.To).To(Equal(dataMigrate.Spec.To))
Expect(copiedDataMigrate.Status).To(Equal(dataMigrate.Status))
Expect(copiedDataMigrate.Spec.From).To(Equal(dataMigrate.Spec.From))
Expect(copiedDataMigrate.Spec.From.DataSet).NotTo(BeIdenticalTo(dataMigrate.Spec.From.DataSet))
Expect(copiedDataMigrate.Spec.To).To(Equal(dataMigrate.Spec.To))
Expect(copiedDataMigrate.Spec.To.ExternalStorage).NotTo(BeIdenticalTo(dataMigrate.Spec.To.ExternalStorage))
Expect(copiedDataMigrate.Status).To(Equal(dataMigrate.Status))

Comment thread api/v1alpha1/dataprocess_types_test.go Outdated
Comment on lines +66 to +67
Expect(copiedDataProcess.Spec.Processor.Script).NotTo(BeNil())
Expect(*copiedDataProcess.Spec.Processor.Script).To(Equal(*dataProcess.Spec.Processor.Script))
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.

medium

To properly verify a deep copy, the test should ensure that the Script pointer in the copied object is distinct from the original one. Checking only value equality is insufficient to distinguish between a deep copy and a shallow copy of the pointer.

Suggested change
Expect(copiedDataProcess.Spec.Processor.Script).NotTo(BeNil())
Expect(*copiedDataProcess.Spec.Processor.Script).To(Equal(*dataProcess.Spec.Processor.Script))
Expect(copiedDataProcess.Spec.Processor.Script).NotTo(BeNil())
Expect(copiedDataProcess.Spec.Processor.Script).NotTo(BeIdenticalTo(dataProcess.Spec.Processor.Script))
Expect(*copiedDataProcess.Spec.Processor.Script).To(Equal(*dataProcess.Spec.Processor.Script))

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 9 out of 9 changed files in this pull request and generated no new comments.

@hxrshxz
Copy link
Copy Markdown
Contributor Author

hxrshxz commented May 17, 2026

/gemini review

@hxrshxz hxrshxz requested a review from Copilot May 17, 2026 12:04
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 migrates the v1alpha1 API unit tests to the Ginkgo and Gomega frameworks, introducing a centralized test suite and comprehensive coverage for DataBackup, DataLoad, DataMigrate, DataProcess, and Dataset types. The changes include refactoring existing tests into descriptive tables and adding deep copy verification. Feedback focuses on improving code maintainability by replacing magic strings with constants for data operation types.

Comment thread api/v1alpha1/dataset_types_test.go Outdated
name: "test3",
fields: fields{
Status: DatasetStatus{},
const dataLoadOperation = "DataLoad"
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.

medium

For better maintainability and consistency, consider defining constants for all data operation types used in the tests instead of using magic strings.

const (
	dataLoadOperation    = "DataLoad"
	dataMigrateOperation = "DataMigrate"
)

Comment thread api/v1alpha1/dataset_types_test.go Outdated
),
Entry("records a different operation type independently",
&Dataset{Status: DatasetStatus{OperationRef: map[string]string{dataLoadOperation: "test1"}}},
"DataMigrate",
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.

medium

Use the newly defined constant dataMigrateOperation here for consistency.

Suggested change
"DataMigrate",
dataMigrateOperation,

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 9 out of 9 changed files in this pull request and generated no new comments.

hxrshxz added 2 commits May 17, 2026 17:37
Signed-off-by: Harsh <harshmastic@gmail.com>
Signed-off-by: Harsh <harshmastic@gmail.com>
hxrshxz added 6 commits May 17, 2026 17:38
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>
Signed-off-by: Harsh <harshmastic@gmail.com>
Signed-off-by: Harsh <harshmastic@gmail.com>
@hxrshxz hxrshxz force-pushed the test/api-v1alpha1-dataops-ginkgo branch from 90f778a to 806f1ed Compare May 17, 2026 12:08
@sonarqubecloud
Copy link
Copy Markdown

@cheyang
Copy link
Copy Markdown
Collaborator

cheyang commented May 18, 2026

/ok-to-test

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.

3 participants