diff --git a/pkg/ddc/alluxio/ufs_test.go b/pkg/ddc/alluxio/ufs_test.go index 445b1a6e4d8..4f39e0d4f7b 100644 --- a/pkg/ddc/alluxio/ufs_test.go +++ b/pkg/ddc/alluxio/ufs_test.go @@ -164,6 +164,7 @@ func TestTotalStorageBytes(t *testing.T) { }) } } + // TestTotalFileNums validates the AlluxioEngine's ability to correctly retrieve total file numbers from the Alluxio runtime. // The test performs the following operations: // - Creates mock AlluxioRuntime configurations @@ -173,7 +174,7 @@ func TestTotalStorageBytes(t *testing.T) { // Test Components: // - fields: Contains the Alluxio runtime configuration and engine identity // - tests: Table-driven test cases with expected values and error conditions -//! +// ! // Flow: // 1. Initialize AlluxioEngine with test parameters // 2. Mock Kubernetes command execution using function patch @@ -1010,6 +1011,29 @@ func TestUpdateMountTime(t *testing.T) { } } +// TestCheckIfRemountRequired tests the checkIfRemountRequired function in AlluxioEngine. +// It verifies whether the system correctly identifies when a remount is required based on: +// - Runtime's last mount time +// - Pod's container start time +// - Dataset mount configurations +// +// Test cases: +// 1. When pod started AFTER last mount time (expect remount) +// - Runtime mount time: yesterday +// - Pod start time: yesterday + 1 day +// - Expected: ["/path"] (remount required) +// 2. When pod started BEFORE last mount time (expect no remount) +// - Runtime mount time: yesterday +// - Pod start time: yesterday - 1 day +// - Expected: [] (no remount needed) +// +// The test: +// - Creates mock runtime, pod and dataset objects +// - Initializes fake Kubernetes client with test objects +// - Mocks AlluxioFileUtils operations: +// - Always reports Ready() = true +// - FindUnmountedAlluxioPaths() returns original paths +// - Compares actual remount paths with expected results func TestCheckIfRemountRequired(t *testing.T) { yesterday := time.Now().AddDate(0, 0, -1)