Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf0271f

Browse files
authored
chore: stop running postgres-only tests if DB is not set (#18784)
Fixescoder/internal#695PostgreSQL tests are getting run in a non-postgres CI job because the tests don't get skipped if the `DB=` env is unset. This PR adds a skip for them.They are flaking in the `test-go-race` CI job. They run fine in the `test-go-race-pg` job, which pre-creates the postgres server, so the flakiness is almost certainly related to spinning up the database server.
1 parent211393a commitbf0271f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎coderd/database/db_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ func TestNestedInTx(t *testing.T) {
8585
functestSQLDB(t testing.TB)*sql.DB {
8686
t.Helper()
8787

88+
if!dbtestutil.WillUsePostgres() {
89+
t.Skip("this test requires postgres")
90+
}
91+
8892
connection,err:=dbtestutil.Open(t)
8993
require.NoError(t,err)
9094

‎coderd/database/dbtestutil/postgres.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func initDefaultConnection(t TBSubset) error {
8181
}
8282

8383
vardbErrerror
84-
// Retry up to3 seconds for temporary errors.
84+
// Retry up to10 seconds for temporary errors.
8585
ctx,cancel:=context.WithTimeout(context.Background(),10*time.Second)
8686
defercancel()
8787
forr:=retry.New(10*time.Millisecond,500*time.Millisecond);r.Wait(ctx); {
@@ -93,7 +93,7 @@ func initDefaultConnection(t TBSubset) error {
9393
if!containsAnySubstring(errString,retryableErrSubstrings) {
9494
break
9595
}
96-
t.Logf("failed to connect to postgres, retrying: %s",errString)
96+
t.Logf("%sfailed to connect to postgres, retrying: %s",time.Now().Format(time.StampMilli),errString)
9797
}
9898

9999
// After the loop dbErr is the last connection error (if any).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp