@@ -76,6 +76,33 @@ func doTestCases(testCases []TestCase, t *testing.T) {
7676 }
7777}
7878
79+ // TestJindoEngine_DeleteVolume tests the DeleteVolume method of JindoEngine under various scenarios.
80+ //
81+ // Parameters:
82+ // - t *testing.T : Go testing framework context for test assertions and logging
83+ //
84+ // Test Strategy:
85+ // 1. Setup test environment with mocked Kubernetes resources:
86+ // - PVs with 'CreatedBy=fluid' annotation to simulate Fluid-managed persistent volumes
87+ // - PVCs with different configurations (normal vs error cases)
88+ // 2. Create 3 test scenarios using parameterized test pattern:
89+ // Case 1: Normal deletion (JindoEngineCommon)
90+ // - Input: Valid PV/PVC without conflicting annotations
91+ // - Expected: Successful deletion (isDeleted=true, isErr=false)
92+ // Case 2: Protected PVC deletion (JindoEngineErr)
93+ // - Input: PVC with 'CreatedBy=fluid' annotation (protected resource)
94+ // - Expected: Failed deletion (isErr=true)
95+ // Case 3: Missing runtime scenario (JindoEngineNoRunTime)
96+ // - Input: Engine with runtime=false configuration
97+ // - Expected: Failed deletion (isErr=true)
98+ // 3. Verification: Uses doTestCases() helper to validate deletion outcomes against expectations
99+ //
100+ // Test Resources:
101+ // - fake.NewFakeClientWithScheme: Simulates Kubernetes API server with predefined resources
102+ // - testScheme: Runtime scheme for Kubernetes API objects
103+ // - testPVInputs/testPVCInputs: Predefined PersistentVolume and PersistentVolumeClaim configurations
104+ //
105+ // Note: This test focuses on edge cases for PVC/PV cleanup workflow in Fluid orchestration system.
79106func TestJindoEngine_DeleteVolume (t * testing.T ) {
80107 testPVInputs := []* v1.PersistentVolume {
81108 {
0 commit comments