diff --git a/pkg/ddc/alluxio/hcfs_test.go b/pkg/ddc/alluxio/hcfs_test.go index dba67846be6..69b605c4dc8 100644 --- a/pkg/ddc/alluxio/hcfs_test.go +++ b/pkg/ddc/alluxio/hcfs_test.go @@ -35,18 +35,32 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) +// 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 { + // 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, - name: name, - namespace: namespace, - Client: client, - runtimeInfo: runTimeInfo, - Log: fake.NullLogger(), - } - return engine + 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 // Return the configured AlluxioEngine instance } func TestGetHCFSStatus(t *testing.T) {