diff --git a/pkg/ddc/alluxio/ufs_test.go b/pkg/ddc/alluxio/ufs_test.go index 9b04fc1a61a..6294ef9b9f0 100644 --- a/pkg/ddc/alluxio/ufs_test.go +++ b/pkg/ddc/alluxio/ufs_test.go @@ -233,6 +233,23 @@ func TestShouldCheckUFS(t *testing.T) { } } + +// TestPrepareUFS tests the PrepareUFS method of AlluxioEngine. +// This method prepares the underlying file system (UFS) by checking +// the Alluxio master state, mounting UFS, and performing necessary +// metadata synchronization. +// +// Test logic: +// 1. Create multiple test cases to simulate different states of +// AlluxioRuntime, Dataset, and StatefulSet. +// 2. Initialize AlluxioEngine and its dependencies using a fake client. +// 3. Use Monkey Patching to mock the behavior of AlluxioFileUtils methods. +// 4. Call e.PrepareUFS() and verify whether the UFS mounting process +// executes correctly. +// 5. Assert that the returned errors match the expected outcomes. +// +// Parameters: +// - t *testing.T: The testing context provided by the Go testing framework. func TestPrepareUFS(t *testing.T) { type fields struct { runtime *datav1alpha1.AlluxioRuntime