Skip to content

test(dataflowaffinity): migrate to Ginkgo/Gomega#5685

Open
hxrshxz wants to merge 5 commits intofluid-cloudnative:masterfrom
hxrshxz:test/dataflowaffinity-ginkgo
Open

test(dataflowaffinity): migrate to Ginkgo/Gomega#5685
hxrshxz wants to merge 5 commits intofluid-cloudnative:masterfrom
hxrshxz:test/dataflowaffinity-ginkgo

Conversation

@hxrshxz
Copy link
Contributor

@hxrshxz hxrshxz commented Mar 9, 2026

Ⅰ. Describe what this PR does

Migrates unit tests in pkg/controllers/v1alpha1/fluidapp/dataflowaffinity/ from the standard testing package to Ginkgo v2/Gomega, adds a package-level suite bootstrap (suite_test.go), and expands test coverage from 39% to 81.4% by adding specs for Reconcile, ControllerName, ManagedResource, and NewDataOpJobReconciler.

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

  • ControllerName — asserts the constant string is returned
  • ManagedResource — asserts a *batchv1.Job is returned
  • NewDataOpJobReconciler — asserts the constructor wires client correctly
  • Reconcile (4 cases): job not found (propagates error), job with cronjob label (skipped/no-requeue), valid fluid job without affinity annotation (annotation injected), complete job with succeeded pod (node labels injected)
  • injectPodNodeLabelsToJob (2 cases): succeeded pod injects annotations; failed-only pod returns error

Ⅳ. Describe how to verify it

go test ./pkg/controllers/v1alpha1/fluidapp/dataflowaffinity/... -v -count=1
go test ./pkg/controllers/v1alpha1/fluidapp/dataflowaffinity/... -coverprofile=/tmp/c.out -covermode=atomic && go tool cover -func=/tmp/c.out | grep total

Ⅴ. Special notes for reviews

N/A

Loading
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