Skip to content

Commit 47285b4

Browse files
committed
bug postgresql: fix flapping tests
Force distinct query to make sure there is no prepared query in prepared query cache. commit_hash:649bcaae32dbc221d809ac57200dcb71887c703d
1 parent 6d7b8d1 commit 47285b4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

postgresql/src/storages/postgres/tests/connection_pgtest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ UTEST_P(PostgreConnection, RollbackOnBusyOeErroredConnection) {
282282
const DefaultCommandControlScope scope2(pg::CommandControl{std::chrono::seconds{2}, std::chrono::milliseconds{200}}
283283
);
284284
GetConn()->Begin({}, {});
285-
UEXPECT_THROW(GetConn()->Execute("select pg_sleep(1)"), pg::QueryCancelled);
285+
UEXPECT_THROW(GetConn()->Execute("select pg_sleep(1.5)"), pg::QueryCancelled);
286286
EXPECT_EQ(pg::ConnectionState::kTranError, GetConn()->GetState());
287287
UEXPECT_NO_THROW(GetConn()->Rollback());
288288
UEXPECT_NO_THROW(GetConn()->CancelAndCleanup(utest::kMaxTestWaitTime));
@@ -308,7 +308,7 @@ UTEST_P(PostgreConnection, CommitOnBusyOeErroredConnection) {
308308
const DefaultCommandControlScope scope2(pg::CommandControl{std::chrono::seconds{2}, std::chrono::milliseconds{200}}
309309
);
310310
GetConn()->Begin({}, {});
311-
UEXPECT_THROW(GetConn()->Execute("select pg_sleep(1)"), pg::QueryCancelled);
311+
UEXPECT_THROW(GetConn()->Execute("select pg_sleep(1.5)"), pg::QueryCancelled);
312312
EXPECT_EQ(pg::ConnectionState::kTranError, GetConn()->GetState());
313313

314314
// Server automatically replaces COMMIT with a ROLLBACK for aborted txns
@@ -333,7 +333,7 @@ UTEST_P(PostgreConnection, StatementTimeout) {
333333
// Query cancelled
334334
const DefaultCommandControlScope scope2(pg::CommandControl{std::chrono::seconds{2}, std::chrono::milliseconds{200}}
335335
);
336-
UEXPECT_THROW(GetConn()->Execute("select pg_sleep(1)"), pg::QueryCancelled);
336+
UEXPECT_THROW(GetConn()->Execute("select pg_sleep(1.5)"), pg::QueryCancelled);
337337
EXPECT_EQ(pg::ConnectionState::kIdle, GetConn()->GetState());
338338
UEXPECT_NO_THROW(GetConn()->CancelAndCleanup(utest::kMaxTestWaitTime));
339339
EXPECT_EQ(pg::ConnectionState::kIdle, GetConn()->GetState());

0 commit comments

Comments
 (0)