Handle metrics test cleanup errors

This commit is contained in:
2026-06-20 18:29:31 +02:00
committed by Milas Holsting
parent 04521675ed
commit 1828306c27

View File

@@ -47,7 +47,11 @@ func TestInstrumentDBRecordsQueryLatency(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("open sqlite: %v", err) t.Fatalf("open sqlite: %v", err)
} }
defer func() { _ = sqlDB.Close() }() defer func() {
if err := sqlDB.Close(); err != nil {
t.Errorf("close sqlite: %v", err)
}
}()
instrumented := InstrumentDB(sqlDB, metrics) instrumented := InstrumentDB(sqlDB, metrics)
if _, err := instrumented.ExecContext(context.Background(), `CREATE TABLE item (id INTEGER PRIMARY KEY)`); err != nil { if _, err := instrumented.ExecContext(context.Background(), `CREATE TABLE item (id INTEGER PRIMARY KEY)`); err != nil {