Skip to content

Commit b56a93e

Browse files
authored
Add comments to newTestJuiceEngine in pkg\ddc\juicefs\delete_volume_test.go (#4562)
Signed-off-by: gentlemar <1287214727@qq.com>
1 parent 9678600 commit b56a93e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/ddc/juicefs/delete_volume_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,24 @@ type TestCase struct {
3939
isErr bool
4040
}
4141

42+
// newTestJuiceEngine creates a JuiceFSEngine for testing
43+
// Parameters:
44+
// - client: fake client
45+
// - name: the name of the JuiceFS engine
46+
// - namespace: the namespace of the JuiceFS engine
47+
// - withRunTime: whether the JuiceFS engine has runtime
48+
// Returns:
49+
// - JuiceFSEngine: the JuiceFS engine for testing
4250
func newTestJuiceEngine(client client.Client, name string, namespace string, withRunTime bool) *JuiceFSEngine {
51+
// 1. Create a JuiceFSRuntime and RuntimeInfo
4352
runTime := &datav1alpha1.JuiceFSRuntime{}
4453
runTimeInfo, _ := base.BuildRuntimeInfo(name, namespace, common.JuiceFSRuntime)
54+
// 2. If the JuiceFS engine does not have runtime, set the runtime and runtimeInfo to nil
4555
if !withRunTime {
4656
runTimeInfo = nil
4757
runTime = nil
4858
}
59+
// 3. Create a JuiceFSEngine
4960
engine := &JuiceFSEngine{
5061
runtime: runTime,
5162
name: name,
@@ -54,6 +65,7 @@ func newTestJuiceEngine(client client.Client, name string, namespace string, wit
5465
runtimeInfo: runTimeInfo,
5566
Log: fake.NullLogger(),
5667
}
68+
// 4. Return the JuiceFSEngine
5769
return engine
5870
}
5971

0 commit comments

Comments
 (0)