Skip to content

Commit d67d74f

Browse files
robsdedudefbiville
authored andcommitted
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 5ca5fbc commit d67d74f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

neo4j/session_with_context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ func (s *sessionWithContext) runRetriable(
324324
if err != nil {
325325
// If the client returns a client specific error that means that
326326
// client wants to rollback. We don't do an explicit rollback here
327-
// but instead realy on pool invoking reset on the connection, that
328-
// will do an implicit rollback.
327+
// but instead rely on the pool invoking reset on the connection,
328+
// that will do an implicit rollback.
329329
state.OnFailure(conn, err, false)
330330
s.pool.Return(ctx, conn)
331331
continue

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)