Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/ddc/juicefs/data_process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

// TestJuiceFSEngine_generateDataProcessValueFile tests the generateDataProcessValueFile function of the JuiceFSEngine.
// It verifies the behavior of the function under different scenarios, including invalid input and missing datasets.
//
// Parameters:
// - t: The testing context used for reporting test failures and logging.
func TestJuiceFSEngine_generateDataProcessValueFile(t *testing.T) {
// 1. Define a sample dataset and dataProcess object for testing.
dataset := &datav1alpha1.Dataset{
ObjectMeta: metav1.ObjectMeta{
Name: "demo-dataset",
Expand Down Expand Up @@ -60,6 +66,7 @@ func TestJuiceFSEngine_generateDataProcessValueFile(t *testing.T) {
},
}

// 2. Define the test cases using a struct to encapsulate the test arguments and expected results.
type args struct {
engine *JuiceFSEngine
ctx cruntime.ReconcileRequestContext
Expand Down Expand Up @@ -111,6 +118,8 @@ func TestJuiceFSEngine_generateDataProcessValueFile(t *testing.T) {
wantErr: false,
},
}

// 3. Run each test case and verify the results.
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := tt.args.engine.generateDataProcessValueFile(tt.args.ctx, tt.args.object)
Expand Down
Loading