From e04dc8cccb61d6f3e0e320f2df994f5d1ef0c983 Mon Sep 17 00:00:00 2001 From: Zhirui Date: Mon, 18 May 2026 19:07:10 +0800 Subject: [PATCH] Add comments to function TestAlluxioFileUtils_ExecMountScripts in pkg/ddc/alluxio/operations/base_test.go Signed-off-by: Zhirui --- pkg/ddc/alluxio/operations/base_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/ddc/alluxio/operations/base_test.go b/pkg/ddc/alluxio/operations/base_test.go index 28382e9f271..e1d3e627538 100644 --- a/pkg/ddc/alluxio/operations/base_test.go +++ b/pkg/ddc/alluxio/operations/base_test.go @@ -642,6 +642,7 @@ func TestAlluxioFileUtils_MasterPodName(t *testing.T) { } func TestAlluxioFileUtils_ExecMountScripts(t *testing.T) { + // Mock exec to avoid invoking the mounted script during the unit test. ExecCommon := func(command []string, verbose bool) (stdout string, stderr string, err error) { return strings.Join(command, " "), "", nil } @@ -652,6 +653,7 @@ func TestAlluxioFileUtils_ExecMountScripts(t *testing.T) { a := &AlluxioFileUtils{log: fake.NullLogger()} patch1 := gomonkey.ApplyPrivateMethod(*a, "exec", ExecErr) + // ExecMountScripts should return the error reported by exec. err := a.ExecMountScripts() if err == nil { t.Error("check failure, want err, got nil") @@ -659,6 +661,7 @@ func TestAlluxioFileUtils_ExecMountScripts(t *testing.T) { patch1.Reset() patch2 := gomonkey.ApplyPrivateMethod(*a, "exec", ExecCommon) + // ExecMountScripts should complete without error when exec succeeds. err = a.ExecMountScripts() if err != nil { t.Errorf("check failure, want nil, got err: %v", err)