--TEST-- MongoDB\Driver\Session::isDirty() --SKIPIF-- --FILE-- selectServer(); $session = $manager->startSession(); printf("New session is dirty: %s\n", $session->isDirty() ? 'yes' : 'no'); $command = new MongoDB\Driver\Command(['ping' => 1]); $server->executeCommand(DATABASE_NAME, $command, ['session' => $session]); printf("Session after successful command is dirty: %s\n", $session->isDirty() ? 'yes' : 'no'); configureTargetedFailPoint($server, 'failCommand', [ 'times' => 1 ], [ 'failCommands' => ['ping'], 'closeConnection' => true ]); throws(function() use ($server, $command, $session) { $server->executeCommand(DATABASE_NAME, $command, ['session' => $session]); }, MongoDB\Driver\Exception\ConnectionTimeoutException::class); printf("Session after network error is dirty: %s\n", $session->isDirty() ? 'yes' : 'no'); ?> ===DONE=== --EXPECT-- New session is dirty: no Session after successful command is dirty: no OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException Session after network error is dirty: yes ===DONE===