Skip to content

Commit

Permalink
Test for pool connection's force close.
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos committed Dec 26, 2024
1 parent 090a459 commit e471fef
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/pool_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,21 @@ void main() {
await expectLater(() => rs, throwsA(isA<PgException>()));
});
});

withPostgresServer('inner connection close', (server) {
test('connection from inside withConnection', () async {
final pool = await openPool(server);
final rs = pool.withConnection((c) async {
await Future.wait([
Future.delayed(
Duration(milliseconds: 200),
() => c.close(force: true),
),
runLongQuery(c),
]);
});
await expectLater(() => rs, throwsA(isA<PgException>()));
});
});
});
}

0 comments on commit e471fef

Please sign in to comment.