Skip to content

Commit 80d319c

Browse files
committed
chore: fix lengthy tests in psql
This was adding at a minimum 3mins to our psql tests!
1 parent ad9a29d commit 80d319c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cli/server_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ func TestServer(t *testing.T) {
122122

123123
const superDuperLong = testutil.WaitSuperLong * 3
124124

125-
ctx := testutil.Context(t, superDuperLong)
125+
ctx, cancelFunc := context.WithTimeout(context.Background(), superDuperLong)
126+
defer cancelFunc()
126127
clitest.Start(t, inv.WithContext(ctx))
127128

128129
//nolint:gocritic // Embedded postgres take a while to fire up.
@@ -1460,8 +1461,8 @@ func TestServer(t *testing.T) {
14601461
})
14611462
}
14621463

1463-
//nolint:tparallel,paralleltest // This test spawns or connects to an existing PostgreSQL instance.
14641464
func TestServer_Production(t *testing.T) {
1465+
t.Parallel()
14651466
if runtime.GOOS != "linux" || testing.Short() {
14661467
// Skip on non-Linux because it spawns a PostgreSQL instance.
14671468
t.SkipNow()
@@ -1471,7 +1472,8 @@ func TestServer_Production(t *testing.T) {
14711472
defer closeFunc()
14721473

14731474
// Postgres + race detector + CI = slow.
1474-
ctx := testutil.Context(t, testutil.WaitSuperLong*3)
1475+
ctx, cancelFunc := context.WithTimeout(context.Background(), testutil.WaitSuperLong*3)
1476+
defer cancelFunc()
14751477

14761478
inv, cfg := clitest.New(t,
14771479
"server",

0 commit comments

Comments
 (0)