diff --git a/pkg/ddc/juicefs/delete_volume_test.go b/pkg/ddc/juicefs/delete_volume_test.go index 1a9527ede0d..fc66bec2cad 100644 --- a/pkg/ddc/juicefs/delete_volume_test.go +++ b/pkg/ddc/juicefs/delete_volume_test.go @@ -183,6 +183,23 @@ func TestJuiceFSEngine_deleteFusePersistentVolume(t *testing.T) { doTestCases(testCases, t) } +// TestJuiceFSEngine_deleteFusePersistentVolumeClaim tests the deletion logic for Fuse-type PersistentVolumeClaims (PVCs) in JuiceFS Engine. +// It validates: +// - Proper handling of PVC finalizers (e.g., kubernetes.io/pvc-protection) +// - Failure scenarios when Runtime integration is disabled +// - Interaction with mocked Kubernetes API using fake client +// +// The test suite includes two primary cases: +// 1. Normal deletion with Runtime enabled (expected success) +// 2. Deletion failure when Runtime is disabled (simulates missing dependency) +// +// Setup steps: +// - Creates test PVCs with protection finalizer to simulate real-world conditions +// - Uses deep copies to ensure test data isolation +// - Configures fake client with predefined test objects for controlled testing +// - Exercises both enabled/disabled Runtime engine variations +// +// This test ensures JuiceFS Engine correctly handles PVC lifecycle operations while respecting Kubernetes resource protection mechanisms. func TestJuiceFSEngine_deleteFusePersistentVolumeClaim(t *testing.T) { testPVCInputs := []*v1.PersistentVolumeClaim{ {