File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ !: BOLT 4.4
2+
3+ A: HELLO {"{}": "*"}
4+ *: RESET
5+ C: BEGIN {"{}": "*"}
6+ S: SUCCESS {}
7+ C: RUN "RETURN 1 AS n" {"{}": "*"} {"{}": "*"}
8+ PULL {"n": {"Z": "*"}, "[qid]": -1}
9+ S: SUCCESS {"fields": ["n"], "qid": 1}
10+ RECORD [1]
11+ RECORD [2]
12+ SUCCESS {"has_more": true, "type": "r"}
13+ C: RUN "invalid" {"{}": "*"} {"{}": "*"}
14+ PULL {"n": {"Z": "*"}, "[qid]": -1}
15+ S: FAILURE {"code": "Neo.ClientError.Statement.SyntaxError", "message": "Invalid input"}
16+ IGNORED
17+ *: RESET
18+ ?: GOODBYE
Original file line number Diff line number Diff line change @@ -258,3 +258,27 @@ def test_failed_tx_run_allows_rollback(self):
258258
259259 def test_failed_tx_run_allows_skipping_rollback (self ):
260260 self ._test_failed_tx_run (rollback = False )
261+
262+ @driver_feature (types .Feature .OPT_PULL_PIPELINING )
263+ def test_should_terminate_tx_after_failed_run (self ):
264+ self ._create_direct_driver ()
265+ self ._server1 .start (
266+ path = self .script_path ("tx_successful_and_failing_streams.script" )
267+ )
268+ self ._session = self ._driver .session ("r" , fetch_size = 2 )
269+ tx = self ._session .begin_transaction ()
270+ res = tx .run ("RETURN 1 AS n" )
271+ with self .assertRaises (types .DriverError ) as exc :
272+ tx .run ("invalid" )
273+ self .assertEqual (exc .exception .code , "Neo.ClientError.Statement.SyntaxError" )
274+
275+ # while already buffered records may be accessible, there must be no
276+ # further PULLs and an exception must be raised
277+ with self .assertRaises (types .DriverError ):
278+ for i in range (0 , 3 ):
279+ res .next ()
280+
281+ tx .close ()
282+ self ._session .close ()
283+ self ._session = None
284+ self ._server1 .done ()
You can’t perform that action at this time.
0 commit comments