From fe993a400cc28fe7204f0aee3f6e801519e88bde Mon Sep 17 00:00:00 2001 From: Rouven Bauer Date: Wed, 7 Apr 2021 17:01:47 +0200 Subject: [PATCH 1/5] Add list of skipped testkit tests --- testkitbackend/skipped_tests.json | 69 ++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/testkitbackend/skipped_tests.json b/testkitbackend/skipped_tests.json index 0967ef424..4adc212fa 100644 --- a/testkitbackend/skipped_tests.json +++ b/testkitbackend/skipped_tests.json @@ -1 +1,68 @@ -{} +{ + "stub.retry.TestRetryClustering.test_retry_ForbiddenOnReadOnlyDatabase_ChangingWriter": + "Closes connection to router after ROUTE", + "stub.routing.Routing.test_should_use_resolver_during_rediscovery_when_existing_routers_fail": + "DNS resolver not implemented", + "stub.routing.RoutingV3.test_should_use_resolver_during_rediscovery_when_existing_routers_fail": + "DNS resolver not implemented", + "stub.routing.RoutingV4.test_should_use_resolver_during_rediscovery_when_existing_routers_fail": + "DNS resolver not implemented", + "stub.routing.NoRouting.test_should_use_resolver_during_rediscovery_when_existing_routers_fail": + "DNS resolver not implemented", + "stub.routing.Routing.test_should_request_rt_from_all_initial_routers_until_successful": + "DNS resolver not implemented", + "stub.routing.RoutingV3.test_should_request_rt_from_all_initial_routers_until_successful": + "DNS resolver not implemented", + "stub.routing.RoutingV4.test_should_request_rt_from_all_initial_routers_until_successful": + "DNS resolver not implemented", + "stub.routing.NoRouting.test_should_request_rt_from_all_initial_routers_until_successful": + "DNS resolver not implemented", + "stub.routing.Routing.test_should_successfully_acquire_rt_when_router_ip_changes": + "DNS resolver not implemented", + "stub.routing.RoutingV3.test_should_successfully_acquire_rt_when_router_ip_changes": + "DNS resolver not implemented", + "stub.routing.RoutingV4.test_should_successfully_acquire_rt_when_router_ip_changes": + "DNS resolver not implemented", + "stub.routing.NoRouting.test_should_successfully_acquire_rt_when_router_ip_changes": + "DNS resolver not implemented", + "stub.routing.Routing.test_should_read_successfully_on_empty_discovery_result_using_session_run": + "Driver iterates over results of custom resolver and settles on first connection yielding a successful handshake", + "stub.routing.RoutingV3.test_should_read_successfully_on_empty_discovery_result_using_session_run": + "Driver iterates over results of custom resolver and settles on first connection yielding a successful handshake", + "stub.routing.RoutingV4.test_should_read_successfully_on_empty_discovery_result_using_session_run": + "Driver iterates over results of custom resolver and settles on first connection yielding a successful handshake", + "stub.routing.NoRouting.test_should_read_successfully_on_empty_discovery_result_using_session_run": + "Driver iterates over results of custom resolver and settles on first connection yielding a successful handshake", + "stub.routing.Routing.test_should_retry_read_tx_and_rediscovery_until_success": + "Driver iterates over results of custom resolver and settles on first connection yielding a successful handshake", + "stub.routing.RoutingV3.test_should_retry_read_tx_and_rediscovery_until_success": + "Driver iterates over results of custom resolver and settles on first connection yielding a successful handshake", + "stub.routing.RoutingV4.test_should_retry_read_tx_and_rediscovery_until_success": + "Driver iterates over results of custom resolver and settles on first connection yielding a successful handshake", + "stub.routing.NoRouting.test_should_retry_read_tx_and_rediscovery_until_success": + "Driver iterates over results of custom resolver and settles on first connection yielding a successful handshake", + "stub.routing.Routing.test_should_retry_write_until_success_with_leader_change_using_tx_function": + "Driver opens a new connection each time to get a fresh routing table", + "stub.routing.RoutingV3.test_should_retry_write_until_success_with_leader_change_using_tx_function": + "Driver opens a new connection each time to get a fresh routing table", + "stub.routing.RoutingV4.test_should_retry_write_until_success_with_leader_change_using_tx_function": + "Driver opens a new connection each time to get a fresh routing table", + "stub.routing.NoRouting.test_should_retry_write_until_success_with_leader_change_using_tx_function": + "Driver opens a new connection each time to get a fresh routing table", + "stub.routing.Routing.test_should_retry_write_until_success_with_leader_shutdown_during_tx_using_tx_function": + "Driver opens a new connection each time to get a fresh routing table", + "stub.routing.RoutingV3.test_should_retry_write_until_success_with_leader_shutdown_during_tx_using_tx_function": + "Driver opens a new connection each time to get a fresh routing table", + "stub.routing.RoutingV4.test_should_retry_write_until_success_with_leader_shutdown_during_tx_using_tx_function": + "Driver opens a new connection each time to get a fresh routing table", + "stub.routing.NoRouting.test_should_retry_write_until_success_with_leader_shutdown_during_tx_using_tx_function": + "Driver opens a new connection each time to get a fresh routing table", + "stub.routing.Routing.test_should_revert_to_initial_router_if_known_router_throws_protocol_errors": + "Driver uses custom resolver for each connection, not only initial seeding", + "stub.routing.RoutingV3.test_should_revert_to_initial_router_if_known_router_throws_protocol_errors": + "Driver uses custom resolver for each connection, not only initial seeding", + "stub.routing.RoutingV4.test_should_revert_to_initial_router_if_known_router_throws_protocol_errors": + "Driver uses custom resolver for each connection, not only initial seeding", + "stub.routing.NoRouting.test_should_revert_to_initial_router_if_known_router_throws_protocol_errors": + "Driver uses custom resolver for each connection, not only initial seeding" +} From c38b2d34611cccadf68d924f616c012b154ae98f Mon Sep 17 00:00:00 2001 From: Rouven Bauer Date: Wed, 7 Apr 2021 17:03:53 +0200 Subject: [PATCH 2/5] Testkit backend: send traceback with BackendError --- testkitbackend/backend.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testkitbackend/backend.py b/testkitbackend/backend.py index 0a406a4ad..fb73af1aa 100644 --- a/testkitbackend/backend.py +++ b/testkitbackend/backend.py @@ -152,10 +152,10 @@ def _process(self, request): if isinstance(e, Neo4jError): payload["code"] = e.code self.send_response("DriverError", payload) - except Exception as e: - traceback.print_exception(type(e), e, e.__traceback__) - self.send_response("BackendError", - {"msg": "%s: %s" % (type(e), e)}) + except Exception: + tb = traceback.format_exc() + log.error(tb) + self.send_response("BackendError", {"msg": tb}) def send_response(self, name, data): """ Sends a response to backend. From 217545f7c2053c3ad8ee948bf76777eac29827ad Mon Sep 17 00:00:00 2001 From: Rouven Bauer Date: Wed, 7 Apr 2021 17:04:15 +0200 Subject: [PATCH 3/5] Decrease max_transaction_retry_time in testkit tests --- testkitbackend/requests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testkitbackend/requests.py b/testkitbackend/requests.py index bb1257a83..9bb20a565 100644 --- a/testkitbackend/requests.py +++ b/testkitbackend/requests.py @@ -133,7 +133,9 @@ def NewSession(backend, data): "default_access_mode": access_mode, "bookmarks": data["bookmarks"], "database": data["database"], - "fetch_size": data.get("fetchSize", None) + "fetch_size": data.get("fetchSize", None), + # testkit breaks up connection after 10 seconds + "max_transaction_retry_time": 5, } session = driver.session(**config) key = backend.next_key() From 8e795e5261f39c46395113c0f33d1d673f7cb695 Mon Sep 17 00:00:00 2001 From: Rouven Bauer Date: Wed, 7 Apr 2021 17:10:07 +0200 Subject: [PATCH 4/5] Code style --- neo4j/io/_bolt3.py | 3 ++- neo4j/io/_bolt4.py | 1 + neo4j/work/result.py | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/neo4j/io/_bolt3.py b/neo4j/io/_bolt3.py index ad90a6529..06ac3328c 100644 --- a/neo4j/io/_bolt3.py +++ b/neo4j/io/_bolt3.py @@ -45,9 +45,9 @@ SessionExpired, ) from neo4j.io import ( - check_supported_server_product, Bolt, BoltPool, + check_supported_server_product, ) from neo4j.io._common import ( CommitResponse, @@ -62,6 +62,7 @@ Unpacker, ) + log = getLogger("neo4j") diff --git a/neo4j/io/_bolt4.py b/neo4j/io/_bolt4.py index ee4c91374..3051f499a 100644 --- a/neo4j/io/_bolt4.py +++ b/neo4j/io/_bolt4.py @@ -62,6 +62,7 @@ Packer, ) + log = getLogger("neo4j") diff --git a/neo4j/work/result.py b/neo4j/work/result.py index 19d768b42..6e8a097e5 100644 --- a/neo4j/work/result.py +++ b/neo4j/work/result.py @@ -47,7 +47,6 @@ def __init__(self, connection, on_network_error): connection raises of of the caught errors. The callback takes the error as argument. :type on_network_error callable - """ self._connection = connection self._on_network_error = on_network_error From 9722b7939a63aaf912f95bd38c8f88e517733b10 Mon Sep 17 00:00:00 2001 From: Rouven Bauer Date: Mon, 12 Apr 2021 13:15:40 +0200 Subject: [PATCH 5/5] Revert "Decrease max_transaction_retry_time in testkit tests" This reverts commit 217545f7c2053c3ad8ee948bf76777eac29827ad. --- testkitbackend/requests.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testkitbackend/requests.py b/testkitbackend/requests.py index 9bb20a565..bb1257a83 100644 --- a/testkitbackend/requests.py +++ b/testkitbackend/requests.py @@ -133,9 +133,7 @@ def NewSession(backend, data): "default_access_mode": access_mode, "bookmarks": data["bookmarks"], "database": data["database"], - "fetch_size": data.get("fetchSize", None), - # testkit breaks up connection after 10 seconds - "max_transaction_retry_time": 5, + "fetch_size": data.get("fetchSize", None) } session = driver.session(**config) key = backend.next_key()