Skip to content

Commit 59b3713

Browse files
authored
Add notation to TestJindoEngine_DeleteVolume in pkg\ddc\jindo\delete_volume_test.go. (#4570)
Signed-off-by: Haipei Zheng <3300877412@qq.com>
1 parent 88f3434 commit 59b3713

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pkg/ddc/jindo/delete_volume_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
79106
func TestJindoEngine_DeleteVolume(t *testing.T) {
80107
testPVInputs := []*v1.PersistentVolume{
81108
{

0 commit comments

Comments
 (0)