Skip to content

Commit 1d56c90

Browse files
committed
Add comments/notation to TestCheckIfRemountRequired(t *testing.T) in pkg\ddc\alluxio\ufs_test.go.
Signed-off-by: HDZ <1416453048@qq.com>
1 parent 0930bc8 commit 1d56c90

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

pkg/ddc/alluxio/ufs_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,29 @@ func TestUpdateMountTime(t *testing.T) {
992992
}
993993
}
994994

995+
// TestCheckIfRemountRequired tests the checkIfRemountRequired function in AlluxioEngine.
996+
// It verifies whether the system correctly identifies when a remount is required based on:
997+
// - Runtime's last mount time
998+
// - Pod's container start time
999+
// - Dataset mount configurations
1000+
//
1001+
// Test cases:
1002+
// 1. When pod started AFTER last mount time (expect remount)
1003+
// - Runtime mount time: yesterday
1004+
// - Pod start time: yesterday + 1 day
1005+
// - Expected: ["/path"] (remount required)
1006+
// 2. When pod started BEFORE last mount time (expect no remount)
1007+
// - Runtime mount time: yesterday
1008+
// - Pod start time: yesterday - 1 day
1009+
// - Expected: [] (no remount needed)
1010+
//
1011+
// The test:
1012+
// - Creates mock runtime, pod and dataset objects
1013+
// - Initializes fake Kubernetes client with test objects
1014+
// - Mocks AlluxioFileUtils operations:
1015+
// - Always reports Ready() = true
1016+
// - FindUnmountedAlluxioPaths() returns original paths
1017+
// - Compares actual remount paths with expected results
9951018
func TestCheckIfRemountRequired(t *testing.T) {
9961019
yesterday := time.Now().AddDate(0, 0, -1)
9971020

0 commit comments

Comments
 (0)