Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CI failures due to race condition in recoverysigner unit tests #5472

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions support/db/dbtest/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ 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
} else if ok {
t.Logf("pq error code: %s", pqErr.Code)
}
urvisavla marked this conversation as resolved.
Show resolved Hide resolved
}
require.NoError(t, err)
Expand Down
Loading