diff --git a/test/pool_test.dart b/test/pool_test.dart index 372ccb8..d13e073 100644 --- a/test/pool_test.dart +++ b/test/pool_test.dart @@ -267,5 +267,21 @@ void main() { await expectLater(() => rs, throwsA(isA())); }); }); + + 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())); + }); + }); }); }