From ded87392a53c4ef5c0aa3838be1f52683a88a7d9 Mon Sep 17 00:00:00 2001 From: two2sides <18735282167@163.com> Date: Wed, 21 May 2025 20:19:18 +0800 Subject: [PATCH 1/3] Add comments to newAlluxioEngineHCFS in pkg/ddc/alluxio/hcfs_test.go Signed-off-by: two2sides <18735282167@163.com> --- pkg/ddc/alluxio/hcfs_test.go | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/pkg/ddc/alluxio/hcfs_test.go b/pkg/ddc/alluxio/hcfs_test.go index dba67846be6..5c9819f1bc1 100644 --- a/pkg/ddc/alluxio/hcfs_test.go +++ b/pkg/ddc/alluxio/hcfs_test.go @@ -35,18 +35,31 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) +// newAlluxioEngineHCFS 创建并返回一个新的 AlluxioEngine 实例。 +// 它使用提供的客户端、名称和命名空间初始化该引擎,并构建 Alluxio 运行时信息。 +// 参数: +// - client: 用于与 Kubernetes API 交互的客户端。 +// - name: Alluxio 引擎的名称。 +// - namespace: Alluxio 引擎的命名空间。 +// 返回: +// - 返回一个配置好的 AlluxioEngine 实例。 func newAlluxioEngineHCFS(client client.Client, name string, namespace string) *AlluxioEngine { + // 创建一个新的 AlluxioRuntime 实例 runTime := &v1alpha1.AlluxioRuntime{} + // 使用 name 和 namespace 构建 Alluxio 运行时信息 runTimeInfo, _ := base.BuildRuntimeInfo(name, namespace, "alluxio") + + // 创建并返回一个新的 AlluxioEngine 实例 engine := &AlluxioEngine{ - runtime: runTime, - name: name, - namespace: namespace, - Client: client, - runtimeInfo: runTimeInfo, - Log: fake.NullLogger(), - } - return engine + runtime: runTime, // 初始化运行时对象 + name: name, // 设置引擎的名称 + namespace: namespace, // 设置引擎的命名空间 + Client: client, // 设置与 Kubernetes API 的客户端 + runtimeInfo: runTimeInfo, // 设置运行时信息 + Log: fake.NullLogger(), // 设置日志记录器(假日志记录器) + } + + return engine // 返回配置好的 AlluxioEngine 实例 } func TestGetHCFSStatus(t *testing.T) { From 8f71d32f29a1b50935d00ca0b933eb15d9ce5a31 Mon Sep 17 00:00:00 2001 From: two2sides <18735282167@163.com> Date: Tue, 27 May 2025 16:02:25 +0800 Subject: [PATCH 2/3] change notation to English Signed-off-by: two2sides <18735282167@163.com> --- pkg/ddc/alluxio/hcfs_test.go | 37 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/pkg/ddc/alluxio/hcfs_test.go b/pkg/ddc/alluxio/hcfs_test.go index 5c9819f1bc1..69b605c4dc8 100644 --- a/pkg/ddc/alluxio/hcfs_test.go +++ b/pkg/ddc/alluxio/hcfs_test.go @@ -35,31 +35,32 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) -// newAlluxioEngineHCFS 创建并返回一个新的 AlluxioEngine 实例。 -// 它使用提供的客户端、名称和命名空间初始化该引擎,并构建 Alluxio 运行时信息。 -// 参数: -// - client: 用于与 Kubernetes API 交互的客户端。 -// - name: Alluxio 引擎的名称。 -// - namespace: Alluxio 引擎的命名空间。 -// 返回: -// - 返回一个配置好的 AlluxioEngine 实例。 +// newAlluxioEngineHCFS creates and returns a new AlluxioEngine instance. +// It initializes the engine using the provided client, name, and namespace, +// and builds the Alluxio runtime information. +// Parameters: +// - client: The client used to interact with the Kubernetes API. +// - name: The name of the Alluxio engine. +// - namespace: The namespace of the Alluxio engine. +// Returns: +// - Returns a configured AlluxioEngine instance. func newAlluxioEngineHCFS(client client.Client, name string, namespace string) *AlluxioEngine { - // 创建一个新的 AlluxioRuntime 实例 + // Create a new AlluxioRuntime instance runTime := &v1alpha1.AlluxioRuntime{} - // 使用 name 和 namespace 构建 Alluxio 运行时信息 + // Build the Alluxio runtime information using the name and namespace runTimeInfo, _ := base.BuildRuntimeInfo(name, namespace, "alluxio") - // 创建并返回一个新的 AlluxioEngine 实例 + // Create and return a new AlluxioEngine instance engine := &AlluxioEngine{ - runtime: runTime, // 初始化运行时对象 - name: name, // 设置引擎的名称 - namespace: namespace, // 设置引擎的命名空间 - Client: client, // 设置与 Kubernetes API 的客户端 - runtimeInfo: runTimeInfo, // 设置运行时信息 - Log: fake.NullLogger(), // 设置日志记录器(假日志记录器) + runtime: runTime, // Initialize the runtime object + name: name, // Set the engine name + namespace: namespace, // Set the engine namespace + Client: client, // Set the Kubernetes API client + runtimeInfo: runTimeInfo, // Set the runtime information + Log: fake.NullLogger(), // Set the logger (fake logger) } - return engine // 返回配置好的 AlluxioEngine 实例 + return engine // Return the configured AlluxioEngine instance } func TestGetHCFSStatus(t *testing.T) { From 909eb6a6a21b42a824e0c76e44cfa52bca161bbc Mon Sep 17 00:00:00 2001 From: two2sides <18735282167@163.com> Date: Sat, 31 May 2025 01:54:39 +0800 Subject: [PATCH 3/3] add notation Signed-off-by: two2sides <18735282167@163.com> --- pkg/ddc/alluxio/hcfs_test.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pkg/ddc/alluxio/hcfs_test.go b/pkg/ddc/alluxio/hcfs_test.go index 69b605c4dc8..6faa00c2d28 100644 --- a/pkg/ddc/alluxio/hcfs_test.go +++ b/pkg/ddc/alluxio/hcfs_test.go @@ -45,22 +45,17 @@ import ( // Returns: // - Returns a configured AlluxioEngine instance. func newAlluxioEngineHCFS(client client.Client, name string, namespace string) *AlluxioEngine { - // Create a new AlluxioRuntime instance runTime := &v1alpha1.AlluxioRuntime{} - // Build the Alluxio runtime information using the name and namespace runTimeInfo, _ := base.BuildRuntimeInfo(name, namespace, "alluxio") - - // Create and return a new AlluxioEngine instance engine := &AlluxioEngine{ - runtime: runTime, // Initialize the runtime object - name: name, // Set the engine name - namespace: namespace, // Set the engine namespace - Client: client, // Set the Kubernetes API client - runtimeInfo: runTimeInfo, // Set the runtime information - Log: fake.NullLogger(), // Set the logger (fake logger) + runtime: runTime, + name: name, + namespace: namespace, + Client: client, + runtimeInfo: runTimeInfo, + Log: fake.NullLogger(), } - - return engine // Return the configured AlluxioEngine instance + return engine } func TestGetHCFSStatus(t *testing.T) {