Skip to content

Commit 43e4150

Browse files
authored
Add comments to TestTransformResourcesForWorkerWithOnlyLimit in pkg\ddc\alluxio\transform_resources_test.go (#4564)
Signed-off-by: juvenhgl <221220019@smail.nju.edu.cn>
1 parent 8107c6c commit 43e4150

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/ddc/alluxio/transform_resources_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,24 @@ func TestTransformResourcesForWorkerWithOnlyRequest(t *testing.T) {
444444
}
445445
}
446446

447+
// TestTransformResourcesForWorkerWithOnlyLimit is a unit test function that validates the transformation
448+
// of resource requirements for Alluxio workers when only resource limits are specified. It ensures that
449+
// the memory and CPU limits are correctly applied to the worker configuration and that the resulting
450+
// resource requests are handled as expected.
451+
//
452+
// The function performs the following steps:
453+
// 1. Defines resource requirements with limits for memory (20Gi) and CPU (500m).
454+
// 2. Sets up test cases to validate the transformation logic, including scenarios with and without
455+
// tiered store configurations.
456+
// 3. Initializes an AlluxioEngine instance with a fake client and runtime objects for testing.
457+
// 4. Transforms the resource requirements for the worker using the AlluxioEngine.
458+
// 5. Validates the transformed resource limits and requests against the expected results.
459+
//
460+
// Test cases include:
461+
// - A scenario where tiered store configuration is provided, ensuring memory limits and requests are set correctly.
462+
// - A scenario without tiered store configuration, ensuring memory limits are set but requests are not.
463+
//
464+
// Errors are reported if the transformation logic does not produce the expected results.
447465
func TestTransformResourcesForWorkerWithOnlyLimit(t *testing.T) {
448466

449467
resources := corev1.ResourceRequirements{}

0 commit comments

Comments
 (0)