@@ -211,7 +211,7 @@ void main() {
211211 });
212212 });
213213
214- group (skip : 'not implemented' , 'force close' , () {
214+ group ('force close' , () {
215215 Future <Pool > openPool (PostgresServer server) async {
216216 final pool = Pool .withEndpoints (
217217 [await server.endpoint ()],
@@ -235,35 +235,36 @@ void main() {
235235 }
236236
237237 withPostgresServer ('pool session' , (server) {
238- test ('' , () async {
238+ test ('pool session ' , () async {
239239 final pool = await openPool (server);
240- // ignore: unawaited_futures
241- runLongQuery (pool);
240+ final started = Completer ();
241+ final rs = pool.run ((s) async {
242+ started.complete ();
243+ await runLongQuery (s);
244+ });
242245 // let it start
246+ await started.future;
243247 await Future .delayed (const Duration (milliseconds: 100 ));
244248 await expectPoolClosesForcefully (pool);
249+
250+ await expectLater (() => rs, throwsA (isA <PgException >()));
245251 });
246252 });
247253
248254 withPostgresServer ('tx session' , (server) {
249- test ('' , () async {
255+ test ('tx ' , () async {
250256 final pool = await openPool (server);
251- // Ignore async error, it will fail when the connection is closed and it tries to do COMMIT
252- pool.runTx (runLongQuery).ignore ();
257+ final started = Completer ();
258+ final rs = pool.runTx ((s) async {
259+ started.complete ();
260+ await runLongQuery (s);
261+ });
253262 // let it start
263+ await started.future;
254264 await Future .delayed (const Duration (milliseconds: 100 ));
255265 await expectPoolClosesForcefully (pool);
256- });
257- });
258266
259- withPostgresServer ('run session' , (server) {
260- test ('' , () async {
261- final pool = await openPool (server);
262- // ignore: unawaited_futures
263- pool.run (runLongQuery);
264- // let it start
265- await Future .delayed (const Duration (milliseconds: 100 ));
266- await expectPoolClosesForcefully (pool);
267+ await expectLater (() => rs, throwsA (isA <PgException >()));
267268 });
268269 });
269270 });
0 commit comments