Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion pkg/ddc/alluxio/ufs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down
Loading