Skip to content

Commit 1a50b6a

Browse files
committed
fixfmt
Signed-off-by: molihh <221220006@smail.nju.edu.cn>
1 parent fc0876d commit 1a50b6a

15 files changed

Lines changed: 87 additions & 82 deletions

pkg/ddc/alluxio/cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ func (e *AlluxioEngine) queryCacheStatus() (states cacheStates, err error) {
6868
// - When the Dataset's UfsTotal field is empty
6969
// - When the Dataset's UfsTotal field contains the metadata sync pending message
7070
// The cached percentage is calculated as (cached bytes / UfsTotal bytes) * 100.
71-
//
71+
//
7272
// Parameters:
7373
// - dataset (v1alpha1.Dataset): Pointer to the Dataset object containing UFS metadata.
7474
// The Status.UfsTotal field must be a valid human-readable size string (e.g. "10GiB")
7575
// - states (cacheStates): Pointer to the cache state structure that will be modified in-place.
7676
// The cached field must be a valid human-readable size string (e.g. "5GiB")
77-
//
77+
//
7878
// Returns:
7979
// - None: Modifies the states.cachedPercentage field directly with formatted percentage string.
8080
// The percentage is stored as a string using cachedPercentageFormat (e.g. "45.60%")

pkg/ddc/alluxio/load_data.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ func (e *AlluxioEngine) genDataLoadValue(image string, targetDataset *datav1alph
175175
// It obtains master pod details, creates file utilities, and checks readiness.
176176
//
177177
// Returns:
178-
// ready bool - Runtime readiness status (true = ready, false = not ready).
178+
//
179+
// ready bool - Runtime readiness status (true = ready, false = not ready).
179180
func (e *AlluxioEngine) CheckRuntimeReady() (ready bool) {
180181
podName, containerName := e.getMasterPodInfo()
181182
fileUtils := operations.NewAlluxioFileUtils(podName, containerName, e.namespace, e.Log)

pkg/ddc/alluxio/master_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ func TestCheckMasterReady(t *testing.T) {
166166

167167
// TestShouldSetupMaster tests the ShouldSetupMaster function of AlluxioEngine.
168168
// Functionality: Verifies if the Alluxio master should be set up based on runtime status.
169-
// Parameters:
169+
// Parameters:
170170
// - t *testing.T: Standard testing object for test reporting and logging.
171+
//
171172
// Return: None (testing function).
172173
// Notes:
173174
// - Uses fake client to simulate interactions with Kubernetes API.

pkg/ddc/alluxio/transform_optimization_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,16 +452,16 @@ func TestAlluxioEngine_setPortProperties(t *testing.T) {
452452
// TestOptimizeDefaultForFuseWithArgs conducts comprehensive validation of the optimizeDefaultFuse method's behavior across distinct parameter versioning contexts
453453
//
454454
// The evaluation encompasses two principal scenarios:
455-
//
455+
//
456456
// 1. Contemporary Fuse Argument Configuration (isNewFuseArgVersion=true):
457-
// - Input Profile: AlluxioRuntime specification containing fuse parameters with fuse-opts directives
458-
// - Expected Outcome: Automatic injection of mount path "/mnt/runtime" and root directory "/" arguments
459-
// - Verification Protocol: Rigorous assertion of argument list completeness including appended paths
457+
// - Input Profile: AlluxioRuntime specification containing fuse parameters with fuse-opts directives
458+
// - Expected Outcome: Automatic injection of mount path "/mnt/runtime" and root directory "/" arguments
459+
// - Verification Protocol: Rigorous assertion of argument list completeness including appended paths
460460
//
461461
// 2. Legacy Fuse Argument Configuration (isNewFuseArgVersion=false):
462-
// - Input Profile: AlluxioRuntime specification with conventional fuse parameters and fuse-opts
463-
// - Expected Outcome: Preservation of original argument structure without path injection
464-
// - Verification Protocol: Strict validation of parameter fidelity to initial configuration
462+
// - Input Profile: AlluxioRuntime specification with conventional fuse parameters and fuse-opts
463+
// - Expected Outcome: Preservation of original argument structure without path injection
464+
// - Verification Protocol: Strict validation of parameter fidelity to initial configuration
465465
//
466466
// Test Case Architecture:
467467
// Each evaluation instance comprises:

pkg/ddc/alluxio/transform_resources.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ func (e *AlluxioEngine) transformResourcesForMaster(runtime *datav1alpha1.Alluxi
4848
}
4949

5050
// transformResourcesForWorker is responsible for transforming and setting resource limits for the Alluxio Worker component.
51-
// This function updates the resource requirements for the Worker and JobWorker based on the runtime configuration
51+
// This function updates the resource requirements for the Worker and JobWorker based on the runtime configuration
5252
// and ensures that memory requests meet the required constraints.
5353
//
5454
// Parameters:
55-
// - runtime: *datav1alpha1.AlluxioRuntime, the runtime configuration of Alluxio, including resource definitions
56-
// for Worker and JobWorker.
55+
// - runtime: *datav1alpha1.AlluxioRuntime, the runtime configuration of Alluxio, including resource definitions
56+
// for Worker and JobWorker.
5757
// - value: *Alluxio, the Alluxio runtime instance used to store the transformed resource information.
58-
//
58+
//
5959
// Return value:
6060
// - error: Returns an error if any issue occurs during resource transformation; otherwise, returns nil.
6161
func (e *AlluxioEngine) transformResourcesForWorker(runtime *datav1alpha1.AlluxioRuntime, value *Alluxio) error {

pkg/ddc/alluxio/transform_resources_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,12 @@ func TestTransformResourcesForWorkerWithOnlyRequest(t *testing.T) {
458458
// resource requests are handled as expected.
459459
//
460460
// The function performs the following steps:
461-
// 1. Defines resource requirements with limits for memory (20Gi) and CPU (500m).
462-
// 2. Sets up test cases to validate the transformation logic, including scenarios with and without
463-
// tiered store configurations.
464-
// 3. Initializes an AlluxioEngine instance with a fake client and runtime objects for testing.
465-
// 4. Transforms the resource requirements for the worker using the AlluxioEngine.
466-
// 5. Validates the transformed resource limits and requests against the expected results.
461+
// 1. Defines resource requirements with limits for memory (20Gi) and CPU (500m).
462+
// 2. Sets up test cases to validate the transformation logic, including scenarios with and without
463+
// tiered store configurations.
464+
// 3. Initializes an AlluxioEngine instance with a fake client and runtime objects for testing.
465+
// 4. Transforms the resource requirements for the worker using the AlluxioEngine.
466+
// 5. Validates the transformed resource limits and requests against the expected results.
467467
//
468468
// Test cases include:
469469
// - A scenario where tiered store configuration is provided, ensuring memory limits and requests are set correctly.

pkg/ddc/alluxio/transform_test.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ func TestTransformMaster(t *testing.T) {
183183
}
184184
}
185185

186-
// TestTransformWorkers verifies that the transformWorkers function correctly transforms
187-
// the worker configuration of AlluxioRuntime into the expected Alluxio structure.
188-
// It tests different network modes, node selectors, and image pull secrets to ensure
186+
// TestTransformWorkers verifies that the transformWorkers function correctly transforms
187+
// the worker configuration of AlluxioRuntime into the expected Alluxio structure.
188+
// It tests different network modes, node selectors, and image pull secrets to ensure
189189
// correct transformation behavior.
190190
func TestTransformWorkers(t *testing.T) {
191191
testCases := map[string]struct {
@@ -588,19 +588,21 @@ func TestGetMediumTypeFromVolumeSource(t *testing.T) {
588588
}
589589
}
590590

591-
// TestAlluxioEngine_allocateSinglePort is a unit test function that tests
591+
// TestAlluxioEngine_allocateSinglePort is a unit test function that tests
592592
// the `allocateSinglePort` method of the `AlluxioEngine` struct.
593-
// The function verifies the behavior of port allocation for Alluxio master
593+
// The function verifies the behavior of port allocation for Alluxio master
594594
// and worker components under different scenarios,
595-
// including when properties are set, unset, or when runtime specifications
595+
// including when properties are set, unset, or when runtime specifications
596596
// are provided.
597-
//
597+
//
598598
// Parameters:
599-
// - t: A testing.T object provided by the Go testing framework, used to
599+
// - t: A testing.T object provided by the Go testing framework, used to
600+
//
600601
// manage test state and support formatted test logs.
601602
//
602603
// Returns:
603-
// - None. The function is a test function and does not return any value.
604+
// - None. The function is a test function and does not return any value.
605+
//
604606
// It reports test failures using the `t.Errorf` method.
605607
func TestAlluxioEngine_allocateSinglePort(t *testing.T) {
606608
// Define the fields required for the AlluxioEngine struct.
@@ -902,10 +904,10 @@ func TestAlluxioEngine_allocatePorts(t *testing.T) {
902904
//
903905
// Test Cases:
904906
// 1. "master properties is not null":
905-
// - Ensures that when master-specific properties exist, they override the global properties.
907+
// - Ensures that when master-specific properties exist, they override the global properties.
906908
//
907909
// 2. "properties is not null for master":
908-
// - Ensures that both master-specific and additional global properties are correctly handled.
910+
// - Ensures that both master-specific and additional global properties are correctly handled.
909911
//
910912
// The function iterates over multiple test cases and checks if the transformed properties
911913
// match the expected values. If the transformation does not produce the expected result, the test fails.

pkg/ddc/alluxio/transform_ufs_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import (
2323
v1 "k8s.io/api/core/v1"
2424
)
2525

26-
// TestTransformDatasetToVolume is a unit test function that verifies the transformation of a Dataset into a UFSPath
27-
// in the Alluxio runtime. It ensures that the Dataset's mount points are correctly converted into corresponding
26+
// TestTransformDatasetToVolume is a unit test function that verifies the transformation of a Dataset into a UFSPath
27+
// in the Alluxio runtime. It ensures that the Dataset's mount points are correctly converted into corresponding
2828
// container and host paths.
2929
//
3030
// Parameters:
@@ -60,7 +60,7 @@ func TestTransformDatasetToVolume(t *testing.T) {
6060
}},
6161
},
6262
}, &Alluxio{}, ufsPath},
63-
63+
6464
// Test case 2: Mount with a path specified
6565
{&datav1alpha1.AlluxioRuntime{}, &datav1alpha1.Dataset{
6666
Spec: datav1alpha1.DatasetSpec{
@@ -72,7 +72,7 @@ func TestTransformDatasetToVolume(t *testing.T) {
7272
},
7373
}, &Alluxio{}, ufsPath1},
7474
}
75-
75+
7676
// Iterate through all test cases and run the test.
7777
for _, test := range tests {
7878
// Create an instance of AlluxioEngine to call the function under test.

pkg/ddc/alluxio/utils_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,16 @@ func TestGetMasterPod(t *testing.T) {
474474
}
475475
}
476476

477-
// TestGetMasterStatefulset tests the getMasterStatefulset method of the AlluxioEngine struct.
478-
// It verifies that the method correctly retrieves the expected StatefulSet based on the provided
479-
// AlluxioRuntime, name, and namespace. The test includes a sample runtime and expected
480-
// StatefulSet, checking for both successful retrieval and error scenarios.
481-
//
482-
// Parameters:
483-
// - t: The test framework's context, which provides methods for logging and error reporting.
484-
//
485-
// Returns:
486-
// - The test does not return any value, but it reports errors using the t.Error and
477+
// TestGetMasterStatefulset tests the getMasterStatefulset method of the AlluxioEngine struct.
478+
// It verifies that the method correctly retrieves the expected StatefulSet based on the provided
479+
// AlluxioRuntime, name, and namespace. The test includes a sample runtime and expected
480+
// StatefulSet, checking for both successful retrieval and error scenarios.
481+
//
482+
// Parameters:
483+
// - t: The test framework's context, which provides methods for logging and error reporting.
484+
//
485+
// Returns:
486+
// - The test does not return any value, but it reports errors using the t.Error and
487487
// t.Errorf methods to indicate whether the test passed or failed.
488488
func TestGetMasterStatefulset(t *testing.T) {
489489
type fields struct {

pkg/ddc/jindo/dataset_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ func TestUpdateDatasetStatus(t *testing.T) {
253253
}
254254
}
255255

256-
// TestBindToDataset tests the BindToDataset method of JindoEngine to verify whether it can correctly bind the dataset to the runtime
257-
// and update the dataset's cache state and HCFS status. The test creates mock Dataset and JindoRuntime objects,
256+
// TestBindToDataset tests the BindToDataset method of JindoEngine to verify whether it can correctly bind the dataset to the runtime
257+
// and update the dataset's cache state and HCFS status. The test creates mock Dataset and JindoRuntime objects,
258258
// uses a fake client to simulate operations, and finally checks if the dataset's Phase, CacheStates, and HCFSStatus match the expected results.
259259
func TestBindToDataset(t *testing.T) {
260260
testDatasetInputs := []*datav1alpha1.Dataset{

0 commit comments

Comments
 (0)