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
14 changes: 14 additions & 0 deletions pkg/ddc/jindo/delete_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ type TestCase struct {
isErr bool
}

// newTestJindoEngine creates a mock JindoEngine instance for testing purposes.
// This helper function is used to simulate JindoEngine behavior under different runtime conditions.
// It accepts a Kubernetes client, a runtime name and namespace, and a boolean flag indicating whether
// to initialize the engine with a runtime.
//
// Parameters:
// - client: a fake or real Kubernetes client used by the engine to interact with cluster resources.
// - name: the name of the JindoRuntime, used to build runtime metadata.
// - namespace: the namespace of the JindoRuntime.
// - withRunTime: if true, the engine will be initialized with a valid JindoRuntime and runtimeInfo;
// if false, the runtime and runtimeInfo will be set to nil, simulating a missing runtime.
//
// Returns:
// - A pointer to the initialized JindoEngine instance, ready for use in unit tests.
func newTestJindoEngine(client client.Client, name string, namespace string, withRunTime bool) *JindoEngine {
runTime := &datav1alpha1.JindoRuntime{}
runTimeInfo, _ := base.BuildRuntimeInfo(name, namespace, common.JindoRuntime)
Expand Down