From 333ce27c16b08299a0f3a6fdf8ccdbe3201aceaa Mon Sep 17 00:00:00 2001 From: Urvi Date: Sun, 22 Sep 2024 20:07:19 -0700 Subject: [PATCH 1/2] fix CI failures due to race condition in recoverysigner unit tests --- support/db/dbtest/db.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/db/dbtest/db.go b/support/db/dbtest/db.go index 18de073224..c0673813e4 100644 --- a/support/db/dbtest/db.go +++ b/support/db/dbtest/db.go @@ -128,8 +128,8 @@ func checkReadOnly(t testing.TB, DSN string) { if !rows.Next() { _, err = tx.Exec("CREATE ROLE user_ro WITH LOGIN PASSWORD 'user_ro';") if err != nil { - // Handle race condition by ignoring the error if it's a duplicate key violation - if pqErr, ok := err.(*pq.Error); ok && pqErr.Code == "23505" { + // Handle race condition by ignoring the error if it's a duplicate key violation or duplicate object error + if pqErr, ok := err.(*pq.Error); ok && (pqErr.Code == "23505" || pqErr.Code == "42710") { return } } From 64f8761136f22fbe7373ef21577ddb4b2c6cf28e Mon Sep 17 00:00:00 2001 From: urvisavla Date: Tue, 24 Sep 2024 00:31:18 -0700 Subject: [PATCH 2/2] Update support/db/dbtest/db.go Co-authored-by: tamirms --- support/db/dbtest/db.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/support/db/dbtest/db.go b/support/db/dbtest/db.go index c0673813e4..42f252b6f8 100644 --- a/support/db/dbtest/db.go +++ b/support/db/dbtest/db.go @@ -131,6 +131,8 @@ func checkReadOnly(t testing.TB, DSN string) { // Handle race condition by ignoring the error if it's a duplicate key violation or duplicate object error if pqErr, ok := err.(*pq.Error); ok && (pqErr.Code == "23505" || pqErr.Code == "42710") { return + } else if ok { + t.Logf("pq error code: %s", pqErr.Code) } } require.NoError(t, err)