@@ -164,6 +164,7 @@ func TestTotalStorageBytes(t *testing.T) {
164164 })
165165 }
166166}
167+
167168// TestTotalFileNums validates the AlluxioEngine's ability to correctly retrieve total file numbers from the Alluxio runtime.
168169// The test performs the following operations:
169170// - Creates mock AlluxioRuntime configurations
@@ -173,7 +174,7 @@ func TestTotalStorageBytes(t *testing.T) {
173174// Test Components:
174175// - fields: Contains the Alluxio runtime configuration and engine identity
175176// - tests: Table-driven test cases with expected values and error conditions
176- //!
177+ // !
177178// Flow:
178179// 1. Initialize AlluxioEngine with test parameters
179180// 2. Mock Kubernetes command execution using function patch
@@ -1010,6 +1011,29 @@ func TestUpdateMountTime(t *testing.T) {
10101011 }
10111012}
10121013
1014+ // TestCheckIfRemountRequired tests the checkIfRemountRequired function in AlluxioEngine.
1015+ // It verifies whether the system correctly identifies when a remount is required based on:
1016+ // - Runtime's last mount time
1017+ // - Pod's container start time
1018+ // - Dataset mount configurations
1019+ //
1020+ // Test cases:
1021+ // 1. When pod started AFTER last mount time (expect remount)
1022+ // - Runtime mount time: yesterday
1023+ // - Pod start time: yesterday + 1 day
1024+ // - Expected: ["/path"] (remount required)
1025+ // 2. When pod started BEFORE last mount time (expect no remount)
1026+ // - Runtime mount time: yesterday
1027+ // - Pod start time: yesterday - 1 day
1028+ // - Expected: [] (no remount needed)
1029+ //
1030+ // The test:
1031+ // - Creates mock runtime, pod and dataset objects
1032+ // - Initializes fake Kubernetes client with test objects
1033+ // - Mocks AlluxioFileUtils operations:
1034+ // - Always reports Ready() = true
1035+ // - FindUnmountedAlluxioPaths() returns original paths
1036+ // - Compares actual remount paths with expected results
10131037func TestCheckIfRemountRequired (t * testing.T ) {
10141038 yesterday := time .Now ().AddDate (0 , 0 , - 1 )
10151039
0 commit comments