Skip to content

Commit a82eec0

Browse files
committed
Add TestKit test skip for unified tx lifetime
Also, don't delete objects stored in the backend while a connection is still open. E.g., maybe TestKit wants to test the driver's behavior of a closed session. Instead, memory will be freed, once the current connection is closed.
1 parent aaf8f3e commit a82eec0

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

neo4j/session.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (s *session) runRetriable(
320320
if err != nil {
321321
// If the client returns a client specific error that means that
322322
// client wants to rollback. We don't do an explicit rollback here
323-
// but instead realy on pool invoking reset on the connection, that
323+
// but instead rely on the pool invoking reset on the connection, that
324324
// will do an implicit rollback.
325325
state.OnFailure(conn, err, false)
326326
s.pool.Return(conn)

testkit-backend/backend.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ func (b *backend) handleTransactionFunc(isRead bool, data map[string]interface{}
268268
txid := b.nextId()
269269
b.transactions[txid] = tx
270270
b.writeResponse("RetryableTry", map[string]interface{}{"id": txid})
271-
defer delete(b.transactions, txid)
272271
// Process all things that the client might do within the transaction
273272
for {
274273
b.process()
@@ -427,7 +426,6 @@ func (b *backend) handleRequest(req map[string]interface{}) {
427426
b.writeError(err)
428427
return
429428
}
430-
delete(b.drivers, driverId)
431429
b.writeResponse("Driver", map[string]interface{}{"id": driverId})
432430

433431
case "NewSession":
@@ -473,7 +471,6 @@ func (b *backend) handleRequest(req map[string]interface{}) {
473471
b.writeError(err)
474472
return
475473
}
476-
delete(b.sessionStates, sessionId)
477474
b.writeResponse("Session", map[string]interface{}{"id": sessionId})
478475

479476
case "SessionRun":
@@ -552,7 +549,6 @@ func (b *backend) handleRequest(req map[string]interface{}) {
552549
case "TransactionClose":
553550
txId := data["txId"].(string)
554551
tx := b.transactions[txId]
555-
delete(b.transactions, txId)
556552
err := tx.Close()
557553
if err != nil {
558554
b.writeError(err)
@@ -867,5 +863,7 @@ func testSkips() map[string]string {
867863
"stub.summary.test_summary.TestSummary.test_server_info": "Needs some kind of server address DNS resolution",
868864
"stub.summary.test_summary.TestSummary.test_invalid_query_type": "Driver does not verify query type returned from server.",
869865
"stub.routing.*.test_should_drop_connections_failing_liveness_check": "Needs support for GetConnectionPoolMetrics",
866+
"stub.tx_lifetime.test_tx_lifetime.TestTxLifetime.test_managed_tx_raises_tx_managed_exec": "Failed tx functions cause a RESET not a ROLLBACK",
867+
"stub.tx_lifetime.test_tx_lifetime.TestTxLifetime.test_unmanaged_tx_raises_tx_closed_exec": "tx.commit, tx.rollback, and tx.close are noops if the tx has already been closed",
870868
}
871869
}

0 commit comments

Comments
 (0)