test(autoassignment): report cleanup errors (HH-423) (#79)

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-21 14:41:25 +08:00
committed by GitHub
co-authored by rogee
parent e665abbfb8
commit 26d494c6d6
@@ -60,8 +60,12 @@ func setupFullAAPostgresDB_Cov9(t *testing.T) (*gorm.DB, *redis.Client) {
schema := fmt.Sprintf("autoassignment_%d", time.Now().UnixNano())
require.NoError(t, admin.Exec("CREATE SCHEMA "+schema).Error)
t.Cleanup(func() {
_ = admin.Exec("DROP SCHEMA " + schema + " CASCADE").Error
_ = adminDB.Close()
if err := admin.Exec("DROP SCHEMA " + schema + " CASCADE").Error; err != nil {
t.Errorf("drop PostgreSQL test schema: %v", err)
}
if err := adminDB.Close(); err != nil {
t.Errorf("close PostgreSQL admin connection: %v", err)
}
})
if strings.HasPrefix(dsn, "postgres://") || strings.HasPrefix(dsn, "postgresql://") {