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 test workflow errors in RecoverySigner unit tests #5398

Merged
merged 2 commits into from
Jul 22, 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
8 changes: 7 additions & 1 deletion support/db/dbtest/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func checkReadOnly(t testing.TB, DSN string) {
require.NoError(t, err)
defer conn.Close()

tx, err := conn.BeginTx(context.Background(), &sql.TxOptions{Isolation: sql.LevelSerializable})
tx, err := conn.BeginTx(context.Background(), &sql.TxOptions{})
require.NoError(t, err)
defer tx.Rollback()

Expand All @@ -127,6 +127,12 @@ func checkReadOnly(t testing.TB, DSN string) {

urvisavla marked this conversation as resolved.
Show resolved Hide resolved
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" {
return
}
}
require.NoError(t, err)
}

Expand Down
Loading