Refactor snapshot management: integrate logging, enhance concurrency with mutex, add clean extraction option, and update gRPC ListSnapshots with ListOptions.

This commit is contained in:
2025-07-07 20:03:40 +03:00
parent 19c02d3573
commit 223a63ee6d
14 changed files with 977 additions and 253 deletions

View File

@ -173,13 +173,32 @@ func TestFullWorkflow(t *testing.T) {
t.Fatalf("Failed to list snapshots: %v", err)
}
// Debug output
t.Logf("After deletion, found %d snapshots:", len(snapshots))
for i, snap := range snapshots {
t.Logf(" Snapshot %d: ID=%s, Name=%s, ParentID=%s", i+1, snap.ID, snap.Name, snap.ParentID)
}
// Get detailed information about snapshot 3
snapshot3, err := ag.GetSnapshotDetails(ctx, snapshot3ID)
if err != nil {
t.Logf("Failed to get snapshot 3 details: %v", err)
} else {
t.Logf("Snapshot 3 details: ID=%s, Name=%s, ParentID=%s", snapshot3.ID, snapshot3.Name, snapshot3.ParentID)
}
// Verify that snapshot 3's parent ID has been updated to point to snapshot 1
if snapshot3 != nil && snapshot3.ParentID != snapshot1ID {
t.Errorf("Snapshot 3's parent ID should be updated to point to Snapshot 1 after Snapshot 2 is deleted. Got ParentID=%s, want ParentID=%s", snapshot3.ParentID, snapshot1ID)
}
if len(snapshots) != 2 {
t.Errorf("Expected 2 snapshots after deletion, got %d", len(snapshots))
}
for _, snap := range snapshots {
if snap.ID == snapshot2ID {
t.Errorf("Snapshot 2 should have been deleted")
t.Errorf("Snapshot 2 (ID=%s) should have been deleted", snapshot2ID)
}
}
}