Skip to content

Commit

Permalink
Drastically increase allowed test times for potato CI
Browse files Browse the repository at this point in the history
The context timeouts for tests are designed to give a better error
message when something hangs rather than the test just timing out.
Unfortunately, the potato CI frequently has some test or another
randomly take a long time. While the increased times are somewhat less
than optimal on a real computer, hopefully this will solve the
flickering CI.
  • Loading branch information
jackc committed Jul 12, 2023
1 parent e0c7020 commit 05440f9
Show file tree
Hide file tree
Showing 19 changed files with 240 additions and 240 deletions.
42 changes: 21 additions & 21 deletions batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func TestConnSendBatch(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestConnSendBatch(t *testing.T) {
func TestConnSendBatchQueuedQuery(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -252,7 +252,7 @@ func TestConnSendBatchQueuedQuery(t *testing.T) {
func TestConnSendBatchMany(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -300,7 +300,7 @@ func TestConnSendBatchWithPreparedStatement(t *testing.T) {
pgx.QueryExecModeExec,
// Don't test simple mode with prepared statements.
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, modes, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -350,7 +350,7 @@ func TestConnSendBatchWithPreparedStatement(t *testing.T) {
func TestConnSendBatchWithQueryRewriter(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -384,7 +384,7 @@ func TestConnSendBatchWithQueryRewriter(t *testing.T) {
func TestConnSendBatchWithPreparedStatementAndStatementCacheDisabled(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

config, err := pgx.ParseConfig(os.Getenv("PGX_TEST_DATABASE"))
Expand Down Expand Up @@ -445,7 +445,7 @@ func TestConnSendBatchWithPreparedStatementAndStatementCacheDisabled(t *testing.
func TestConnSendBatchCloseRowsPartiallyRead(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -507,7 +507,7 @@ func TestConnSendBatchCloseRowsPartiallyRead(t *testing.T) {
func TestConnSendBatchQueryError(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -548,7 +548,7 @@ func TestConnSendBatchQueryError(t *testing.T) {
func TestConnSendBatchQuerySyntaxError(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -575,7 +575,7 @@ func TestConnSendBatchQuerySyntaxError(t *testing.T) {
func TestConnSendBatchQueryRowInsert(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -615,7 +615,7 @@ func TestConnSendBatchQueryRowInsert(t *testing.T) {
func TestConnSendBatchQueryPartialReadInsert(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -655,7 +655,7 @@ func TestConnSendBatchQueryPartialReadInsert(t *testing.T) {
func TestTxSendBatch(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -725,7 +725,7 @@ func TestTxSendBatch(t *testing.T) {
func TestTxSendBatchRollback(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -764,7 +764,7 @@ func TestTxSendBatchRollback(t *testing.T) {
func TestSendBatchErrorWhileReadingResultsWithoutCallback(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -788,7 +788,7 @@ func TestSendBatchErrorWhileReadingResultsWithoutCallback(t *testing.T) {
func TestSendBatchErrorWhileReadingResultsWithExecWhereSomeRowsAreReturned(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -812,7 +812,7 @@ func TestSendBatchErrorWhileReadingResultsWithExecWhereSomeRowsAreReturned(t *te
func TestConnBeginBatchDeferredError(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -860,7 +860,7 @@ func TestConnBeginBatchDeferredError(t *testing.T) {
}

func TestConnSendBatchNoStatementCache(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

config := mustParseConfig(t, os.Getenv("PGX_TEST_DATABASE"))
Expand All @@ -875,7 +875,7 @@ func TestConnSendBatchNoStatementCache(t *testing.T) {
}

func TestConnSendBatchPrepareStatementCache(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

config := mustParseConfig(t, os.Getenv("PGX_TEST_DATABASE"))
Expand All @@ -889,7 +889,7 @@ func TestConnSendBatchPrepareStatementCache(t *testing.T) {
}

func TestConnSendBatchDescribeStatementCache(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

config := mustParseConfig(t, os.Getenv("PGX_TEST_DATABASE"))
Expand Down Expand Up @@ -931,7 +931,7 @@ func testConnSendBatch(t *testing.T, ctx context.Context, conn *pgx.Conn, queryC
func TestSendBatchSimpleProtocol(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

config := mustParseConfig(t, os.Getenv("PGX_TEST_DATABASE"))
Expand Down Expand Up @@ -970,7 +970,7 @@ func TestSendBatchSimpleProtocol(t *testing.T) {
}

func ExampleConn_SendBatch() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

conn, err := pgx.Connect(ctx, os.Getenv("PGX_TEST_DATABASE"))
Expand Down
34 changes: 17 additions & 17 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func TestParseConfigErrors(t *testing.T) {
func TestExec(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -261,7 +261,7 @@ func (qr *testQueryRewriter) RewriteQuery(ctx context.Context, conn *pgx.Conn, s
func TestExecWithQueryRewriter(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -274,7 +274,7 @@ func TestExecWithQueryRewriter(t *testing.T) {
func TestExecFailure(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -293,7 +293,7 @@ func TestExecFailure(t *testing.T) {
func TestExecFailureWithArguments(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -311,7 +311,7 @@ func TestExecFailureWithArguments(t *testing.T) {
func TestExecContextWithoutCancelation(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -332,7 +332,7 @@ func TestExecContextWithoutCancelation(t *testing.T) {
func TestExecContextFailureWithoutCancelation(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -357,7 +357,7 @@ func TestExecContextFailureWithoutCancelation(t *testing.T) {
func TestExecContextFailureWithoutCancelationWithArguments(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -512,7 +512,7 @@ func TestPrepareIdempotency(t *testing.T) {
func TestPrepareStatementCacheModes(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -755,7 +755,7 @@ func TestFatalTxError(t *testing.T) {
func TestInsertBoolArray(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -773,7 +773,7 @@ func TestInsertBoolArray(t *testing.T) {
func TestInsertTimestampArray(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -858,7 +858,7 @@ func TestConnInitTypeMap(t *testing.T) {
}

func TestUnregisteredTypeUsableAsStringArgumentAndBaseResult(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -877,7 +877,7 @@ func TestUnregisteredTypeUsableAsStringArgumentAndBaseResult(t *testing.T) {
}

func TestDomainType(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -914,7 +914,7 @@ func TestDomainType(t *testing.T) {
}

func TestLoadTypeSameNameInDifferentSchemas(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -959,7 +959,7 @@ create type pgx_b.point as (c text);
}

func TestLoadCompositeType(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand All @@ -981,7 +981,7 @@ func TestLoadCompositeType(t *testing.T) {
}

func TestLoadRangeType(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -1015,7 +1015,7 @@ func TestLoadRangeType(t *testing.T) {
}

func TestLoadMultiRangeType(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down Expand Up @@ -1205,7 +1205,7 @@ func TestStmtCacheInvalidationTx(t *testing.T) {
}

func TestInsertDurationInterval(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
Expand Down
Loading

0 comments on commit 05440f9

Please sign in to comment.