Enhance snapshot handling by backfilling provisioned disk data and updating backfill logic
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-13 16:17:56 +11:00
parent c446638eac
commit 6fbd6bc9d2
4 changed files with 38 additions and 5 deletions

View File

@@ -104,3 +104,19 @@ func TestBackfillSnapshotRowFromHourlyCacheNoMatch(t *testing.T) {
t.Fatal("expected no backfill change for missing VM")
}
}
func TestNeedsSnapshotBackfillIgnoresDiskOnlyGap(t *testing.T) {
row := InventorySnapshotRow{
CreationTime: sql.NullInt64{Int64: 100, Valid: true},
VcpuCount: sql.NullInt64{Int64: 2, Valid: true},
RamGB: sql.NullInt64{Int64: 8, Valid: true},
Cluster: sql.NullString{String: "cluster-a", Valid: true},
Datacenter: sql.NullString{String: "dc-a", Valid: true},
SrmPlaceholder: "FALSE",
VmUuid: sql.NullString{String: "uuid-1", Valid: true},
// ProvisionedDisk intentionally missing.
}
if needsSnapshotBackfill(row) {
t.Fatal("expected disk-only gap to be non-critical for sparse-row detection")
}
}