From 177ce992b4ef794b426600b14b69b612305e8c37 Mon Sep 17 00:00:00 2001 From: AritxOnly Date: Fri, 19 Jun 2026 22:15:52 +0800 Subject: [PATCH] Add comments/notation to TestGenerateDataLoadValueFile in fluid/pkg/ddc/alluxio/load_data_test.go. --- pkg/ddc/alluxio/load_data_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/ddc/alluxio/load_data_test.go b/pkg/ddc/alluxio/load_data_test.go index 03b8e6957e0..d6fc41a4015 100644 --- a/pkg/ddc/alluxio/load_data_test.go +++ b/pkg/ddc/alluxio/load_data_test.go @@ -36,7 +36,11 @@ import ( "k8s.io/apimachinery/pkg/runtime" ) +// TestGenerateDataLoadValueFile verifies that generateDataLoadValueFile creates +// a temporary values file for a DataLoad and returns the generated file path +// for both empty-target and explicit-target configurations. func TestGenerateDataLoadValueFile(t *testing.T) { + // Prepare a dataset in the fake client so the dataload can resolve its target dataset. datasetInputs := []datav1alpha1.Dataset{ { ObjectMeta: metav1.ObjectMeta{ @@ -54,6 +58,8 @@ func TestGenerateDataLoadValueFile(t *testing.T) { context := cruntime.ReconcileRequestContext{ Client: client, } + + // Cover both branches where the dataload has no explicit targets and where it does. dataLoadNoTarget := datav1alpha1.DataLoad{ ObjectMeta: metav1.ObjectMeta{ Name: "test-dataload", @@ -98,6 +104,8 @@ func TestGenerateDataLoadValueFile(t *testing.T) { expectFileName: filepath.Join(os.TempDir(), "fluid-test-dataload-loader-values.yaml"), }, } + + // Generate the values file and assert that the returned temp file path matches the expected pattern. for _, test := range testCases { engine := AlluxioEngine{} if fileName, err := engine.generateDataLoadValueFile(context, &test.dataLoad); !strings.Contains(fileName, test.expectFileName) {