From 5e574fcf9130766eff5a8999e921b70ab92f0cc6 Mon Sep 17 00:00:00 2001 From: Srj Date: Thu, 22 May 2025 14:27:22 +0800 Subject: [PATCH 1/3] Add comments/notation to TestInvokeCleanCache in pkg\ddc\alluxio\cache_test.go. Signed-off-by: Srj --- pkg/ddc/alluxio/cache_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/ddc/alluxio/cache_test.go b/pkg/ddc/alluxio/cache_test.go index f68d74f07ab..7ef425abe0d 100644 --- a/pkg/ddc/alluxio/cache_test.go +++ b/pkg/ddc/alluxio/cache_test.go @@ -230,7 +230,20 @@ func TestPatchDatasetStatus(t *testing.T) { } } } - +// TestInvokeCleanCache tests the behavior of the invokeCleanCache function in the AlluxioEngine. +// It simulates different StatefulSet statuses using a fake client to verify whether the function +// correctly determines if an error should be returned based on the readiness state of the replicas. +// +// Test cases include: +// - A component with no ready replicas (expected: no error) +// - A component with ready replicas (expected: error) +// - A non-existent component (expected: no error) +// +// Parameters: +// - t (*testing.T): The testing context used to run assertions. +// +// Returns: +// - None. The function uses t.Errorf to report test failures. func TestInvokeCleanCache(t *testing.T) { masterInputs := []*appsv1.StatefulSet{ { From e766d5293a488f0183f5cd632f7e1a30132a6442 Mon Sep 17 00:00:00 2001 From: Srj Date: Sun, 25 May 2025 10:30:52 +0800 Subject: [PATCH 2/3] add comments to TestInvokeCleanCache in pkg\ddc\alluxio\cache_test.go. Signed-off-by: Srj --- pkg/ddc/alluxio/cache_test.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pkg/ddc/alluxio/cache_test.go b/pkg/ddc/alluxio/cache_test.go index 7ef425abe0d..47e882ba18f 100644 --- a/pkg/ddc/alluxio/cache_test.go +++ b/pkg/ddc/alluxio/cache_test.go @@ -233,12 +233,7 @@ func TestPatchDatasetStatus(t *testing.T) { // TestInvokeCleanCache tests the behavior of the invokeCleanCache function in the AlluxioEngine. // It simulates different StatefulSet statuses using a fake client to verify whether the function // correctly determines if an error should be returned based on the readiness state of the replicas. -// -// Test cases include: -// - A component with no ready replicas (expected: no error) -// - A component with ready replicas (expected: error) -// - A non-existent component (expected: no error) -// +// // Parameters: // - t (*testing.T): The testing context used to run assertions. // From 7723ab9bd5b5629a6842907246d40672aa3607d3 Mon Sep 17 00:00:00 2001 From: cheyang Date: Sun, 25 May 2025 17:56:47 +0800 Subject: [PATCH 3/3] fix go fmt issue of pkg/ddc/alluxio/cache_test.go Signed-off-by: cheyang --- pkg/ddc/alluxio/cache_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/ddc/alluxio/cache_test.go b/pkg/ddc/alluxio/cache_test.go index 47e882ba18f..62b73c6900d 100644 --- a/pkg/ddc/alluxio/cache_test.go +++ b/pkg/ddc/alluxio/cache_test.go @@ -230,13 +230,14 @@ func TestPatchDatasetStatus(t *testing.T) { } } } + // TestInvokeCleanCache tests the behavior of the invokeCleanCache function in the AlluxioEngine. // It simulates different StatefulSet statuses using a fake client to verify whether the function // correctly determines if an error should be returned based on the readiness state of the replicas. // // Parameters: // - t (*testing.T): The testing context used to run assertions. -// +// // Returns: // - None. The function uses t.Errorf to report test failures. func TestInvokeCleanCache(t *testing.T) {