Skip to content

Commit 427e332

Browse files
authored
Remove all temporary feature flags (#446)
They have been implemented in all drivers
1 parent bd20cfe commit 427e332

15 files changed

+35
-158
lines changed

nutkit/protocol/feature.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -113,43 +113,3 @@ class Feature(Enum):
113113
# routing table and assume all other connections to the server are dead
114114
# as well.
115115
CONF_HINT_CON_RECV_TIMEOUT = "ConfHint:connection.recv_timeout_seconds"
116-
117-
# Temporary driver feature that will be removed when all official driver
118-
# backends have implemented the connection acquisition timeout config.
119-
TMP_CONNECTION_ACQUISITION_TIMEOUT = \
120-
"Temporary:ConnectionAcquisitionTimeout"
121-
# Temporary driver feature that will be removed when all official driver
122-
# backends have implemented path and relationship types
123-
TMP_CYPHER_PATH_AND_RELATIONSHIP = "Temporary:CypherPathAndRelationship"
124-
# TODO Update this once the decision has been made.
125-
# Temporary driver feature. There is a pending decision on whether it
126-
# should be supported in all drivers or be removed from all of them.
127-
TMP_DRIVER_FETCH_SIZE = "Temporary:DriverFetchSize"
128-
# Temporary driver feature that will be removed when all official driver
129-
# backends have implemented the max connection pool size config.
130-
TMP_DRIVER_MAX_CONNECTION_POOL_SIZE = \
131-
"Temporary:DriverMaxConnectionPoolSize"
132-
# Temporary driver feature that will be removed when all official driver
133-
# backends have implemented it.
134-
TMP_DRIVER_MAX_TX_RETRY_TIME = "Temporary:DriverMaxTxRetryTime"
135-
# Temporary driver feature that will be removed when all official driver
136-
# implemented failing fast and surfacing on certain error codes during
137-
# discovery (initial fetching of a RT).
138-
TMP_FAST_FAILING_DISCOVERY = "Temporary:FastFailingDiscovery"
139-
# Temporary driver feature that will be removed when all official driver
140-
# backends have implemented all summary response fields.
141-
TMP_FULL_SUMMARY = "Temporary:FullSummary"
142-
# Temporary driver feature that will be removed when all official driver
143-
# backends have implemented the GetConnectionPoolMetrics request.
144-
TMP_GET_CONNECTION_POOL_METRICS = \
145-
"Temporary:GetConnectionPoolMetrics"
146-
# Temporary driver feature that will be removed when all official drivers
147-
# have been unified in their behaviour of when they return a Result object.
148-
# We aim for drivers to not providing a Result until the server replied
149-
# with SUCCESS so that the result keys are already known and attached to
150-
# the Result object without further waiting or communication with the
151-
# server.
152-
TMP_RESULT_KEYS = "Temporary:ResultKeys"
153-
# Temporary driver feature that will be removed when all official driver
154-
# backends have implemented the TransactionClose request
155-
TMP_TRANSACTION_CLOSE = "Temporary:TransactionClose"

nutkit/protocol/requests.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,11 @@ def __init__(
6262
self.resolverRegistered = resolverRegistered
6363
self.domainNameResolverRegistered = domainNameResolverRegistered
6464
self.connectionTimeoutMs = connectionTimeoutMs
65-
# TODO: remove assertion and condition as soon as all drivers support
66-
# driver-scoped fetch-size config
67-
from .feature import Feature
68-
assert hasattr(Feature, "TMP_DRIVER_FETCH_SIZE")
69-
if fetchSize is not None:
70-
self.fetchSize = fetchSize
71-
# TODO: remove assertion and condition as soon as all drivers support
72-
# driver-scoped fetch-size config
73-
assert hasattr(Feature, "TMP_DRIVER_MAX_TX_RETRY_TIME")
74-
if maxTxRetryTimeMs is not None:
75-
self.maxTxRetryTimeMs = maxTxRetryTimeMs
76-
if liveness_check_timeout_ms is not None:
77-
self.livenessCheckTimeoutMs = liveness_check_timeout_ms
78-
# TODO: remove assertion and condition as soon as all drivers support
79-
# driver-scoped max connection pool size config
80-
assert hasattr(Feature, "TMP_DRIVER_MAX_CONNECTION_POOL_SIZE")
81-
if max_connection_pool_size is not None:
82-
self.maxConnectionPoolSize = max_connection_pool_size
83-
# TODO: remove assertion and condition as soon as all drivers support
84-
# driver-scoped connection acquisition timeout config
85-
assert hasattr(Feature, "TMP_CONNECTION_ACQUISITION_TIMEOUT")
86-
if connection_acquisition_timeout_ms is not None:
87-
self.connectionAcquisitionTimeoutMs = \
88-
connection_acquisition_timeout_ms
65+
self.fetchSize = fetchSize
66+
self.maxTxRetryTimeMs = maxTxRetryTimeMs
67+
self.livenessCheckTimeoutMs = liveness_check_timeout_ms
68+
self.maxConnectionPoolSize = max_connection_pool_size
69+
self.connectionAcquisitionTimeoutMs = connection_acquisition_timeout_ms
8970
# (bool) whether to enable or disable encryption
9071
# field missing in message: use driver default (should be False)
9172
if encrypted is not None:

tests/neo4j/test_bookmarks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def test_can_pass_bookmark_into_next_session(self):
5252
tx = self._session.begin_transaction()
5353
result = tx.run("MATCH (a:Thing {uuid:$uuid}) RETURN a",
5454
params={"uuid": types.CypherString(unique_id)})
55-
if self.driver_supports_features(types.Feature.TMP_RESULT_KEYS):
55+
if get_driver_name() not in ["dotnet"]:
56+
# missing former types.Feature.TMP_RESULT_KEYS
5657
self.assertEqual(result.keys(), ["a"])
5758
records = [rec.values[0] for rec in result]
5859
tx.commit()

tests/neo4j/test_direct_driver.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from ..shared import (
44
dns_resolve_single,
5-
driver_feature,
65
get_driver_name,
76
TestkitTestCase,
87
)
@@ -75,7 +74,6 @@ def test_fail_nicely_when_using_http_port(self):
7574
self.assertEqual(e.exception.errorType,
7675
"<class 'neo4j.exceptions.ServiceUnavailable'>")
7776

78-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
7977
def test_supports_multi_db(self):
8078
def work(tx):
8179
return tx.run("RETURN 1 as n").consume()
@@ -116,7 +114,6 @@ def test_multi_db_non_existing(self):
116114
self.assertEqual(exc.errorType,
117115
"<class 'neo4j.exceptions.ClientError'>")
118116

119-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
120117
@requires_multi_db_support
121118
@cluster_unsafe_test
122119
def test_multi_db(self):
@@ -161,17 +158,17 @@ def get_names(result_, node=True):
161158
for record in result_:
162159
if node:
163160
self.assertEqual(len(record.values), 1)
164-
if self.driver_supports_features(
165-
types.Feature.TMP_RESULT_KEYS):
161+
if get_driver_name() not in ["dotnet"]:
162+
# missing former types.Feature.TMP_RESULT_KEYS
166163
self.assertEqual(result_.keys(), ["p"])
167164
p = record.values[0]
168165
self.assertIsInstance(p, types.CypherNode)
169166
self.assertIsInstance(p.props, types.CypherMap)
170167
name = p.props.value.get("name")
171168
else:
172169
idx = 0
173-
if self.driver_supports_features(
174-
types.Feature.TMP_RESULT_KEYS):
170+
if get_driver_name() not in ["dotnet"]:
171+
# missing former types.Feature.TMP_RESULT_KEYS
175172
keys = result_.keys()
176173
self.assertIn("name", keys)
177174
idx = keys.index("name")

tests/neo4j/test_session_run.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
get_server_info,
66
)
77
from tests.shared import (
8-
driver_feature,
98
get_driver_name,
109
TestkitTestCase,
1110
)
@@ -41,8 +40,9 @@ def test_iteration_smaller_than_fetch_size(self):
4140
types.NullRecord(),
4241
types.NullRecord()
4342
]
44-
if self.driver_supports_features(types.Feature.TMP_RESULT_KEYS):
45-
assert result.keys() == ["x"]
43+
if get_driver_name() not in ["dotnet"]:
44+
# missing former types.Feature.TMP_RESULT_KEYS
45+
self.assertEqual(result.keys(), ["x"])
4646
for exp in expects:
4747
rec = result.next()
4848
self.assertEqual(rec, exp)
@@ -69,7 +69,6 @@ def test_can_return_node(self):
6969
self.assertIsInstance(result.next(), types.NullRecord)
7070
isinstance(result.next(), types.NullRecord)
7171

72-
@driver_feature(types.Feature.TMP_CYPHER_PATH_AND_RELATIONSHIP)
7372
@cluster_unsafe_test
7473
def test_can_return_relationship(self):
7574
self._session1 = self._driver.session("w")
@@ -88,7 +87,6 @@ def test_can_return_relationship(self):
8887
self.assertIsInstance(result.next(), types.NullRecord)
8988
isinstance(result.next(), types.NullRecord)
9089

91-
@driver_feature(types.Feature.TMP_CYPHER_PATH_AND_RELATIONSHIP)
9290
@cluster_unsafe_test
9391
def test_can_return_path(self):
9492
self._session1 = self._driver.session("w")

tests/neo4j/test_summary.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from nutkit import protocol as types
22

33
from ..shared import (
4-
driver_feature,
54
get_driver_name,
65
TestkitTestCase,
76
)
@@ -38,44 +37,37 @@ def work(tx):
3837
self._session = self._driver.session("w")
3938
return self._session.write_transaction(work)
4039

41-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
4240
def test_can_obtain_summary_after_consuming_result(self):
4341
summary = self.get_summary("CREATE (n) RETURN n")
4442
self.assertEqual(summary.query.text, "CREATE (n) RETURN n")
4543
self.assertEqual(summary.query.parameters, {})
4644
self.assertEqual(summary.query_type, "rw")
4745
self.assertEqual(summary.counters.nodes_created, 1)
4846

49-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
5047
def test_no_plan_info(self):
5148
summary = self.get_summary("CREATE (n) RETURN n")
5249
self.assertIsNone(summary.plan)
5350
self.assertIsNone(summary.profile)
5451

55-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
5652
def test_can_obtain_plan_info(self):
5753
summary = self.get_summary("EXPLAIN CREATE (n) RETURN n")
5854
self.assertIsInstance(summary.plan, dict)
5955

60-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
6156
def test_can_obtain_profile_info(self):
6257
summary = self.get_summary("PROFILE CREATE (n) RETURN n")
6358
self.assertIsInstance(summary.profile, dict)
6459

65-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
6660
def test_no_notification_info(self):
6761
summary = self.get_summary("CREATE (n) RETURN n")
6862
self.assertIsNone(summary.notifications)
6963

70-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
7164
def test_can_obtain_notification_info(self):
7265
summary = self.get_summary("EXPLAIN MATCH (n), (m) RETURN n, m")
7366
notifications = summary.notifications
7467
self.assertIsInstance(notifications, list)
7568
self.assertEqual(len(notifications), 1)
7669
self.assertIsInstance(notifications[0], dict)
7770

78-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
7971
def test_contains_time_information(self):
8072
summary = self.get_summary("UNWIND range(1, 100) AS n "
8173
"RETURN n AS number")
@@ -86,7 +78,6 @@ def test_contains_time_information(self):
8678
self.assertGreaterEqual(summary.result_available_after, 0)
8779
self.assertGreaterEqual(summary.result_consumed_after, 0)
8880

89-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
9081
def test_protocol_version_information(self):
9182
summary = self.get_summary("RETURN 1 AS number")
9283

@@ -148,7 +139,6 @@ def _assert_counters(self, summary, nodes_created=0, nodes_deleted=0,
148139
self.assertIsInstance(counter_val, type(val))
149140
self.assertEqual(counter_val, val)
150141

151-
@driver_feature(types.Feature.TMP_FULL_SUMMARY)
152142
def test_summary_counters_case_1(self):
153143
params = {"number": types.CypherInt(3)}
154144

@@ -161,8 +151,6 @@ def test_summary_counters_case_1(self):
161151

162152
self._assert_counters(summary)
163153

164-
@driver_feature(types.Feature.TMP_RESULT_KEYS,
165-
types.Feature.TMP_FULL_SUMMARY)
166154
@requires_multi_db_support
167155
@cluster_unsafe_test
168156
def test_summary_counters_case_2(self):

tests/neo4j/test_tx_func_run.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ def test_tx_func_configuration(self):
176176
def run(tx):
177177
values = []
178178
result = tx.run("UNWIND [1,2,3,4] AS x RETURN x")
179-
if self.driver_supports_features(types.Feature.TMP_RESULT_KEYS):
179+
if get_driver_name() not in ["dotnet"]:
180+
# missing former types.Feature.TMP_RESULT_KEYS
180181
self.assertEqual(result.keys(), ["x"])
181182
for record in result:
182183
values.append(record.values[0])

tests/neo4j/test_tx_run.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ def test_tx_configuration(self):
322322
)
323323
result = tx.run("UNWIND [1,2,3,4] AS x RETURN x")
324324
values = []
325-
if self.driver_supports_features(types.Feature.TMP_RESULT_KEYS):
325+
if get_driver_name() not in ["dotnet"]:
326+
# missing former types.Feature.TMP_RESULT_KEYS
326327
self.assertEqual(result.keys(), ["x"])
327328
for record in result:
328329
values.append(record.values[0])
@@ -368,7 +369,8 @@ def test_consume_after_commit(self):
368369
self._session1 = self._driver.session("w", fetch_size=2)
369370
tx = self._session1.begin_transaction()
370371
result = tx.run("UNWIND [1,2,3,4] AS x RETURN x")
371-
if self.driver_supports_features(types.Feature.TMP_RESULT_KEYS):
372+
if get_driver_name() not in ["dotnet"]:
373+
# missing former types.Feature.TMP_RESULT_KEYS
372374
self.assertEqual(result.keys(), ["x"])
373375
values = []
374376
for _ in range(2):
@@ -390,7 +392,8 @@ def _test():
390392
tx = self._session1.begin_transaction()
391393
result1 = tx.run("UNWIND [1,2,3,4] AS x RETURN x")
392394
result2 = tx.run("UNWIND [5,6,7,8] AS x RETURN x")
393-
if self.driver_supports_features(types.Feature.TMP_RESULT_KEYS):
395+
if get_driver_name() not in ["dotnet"]:
396+
# missing former types.Feature.TMP_RESULT_KEYS
394397
self.assertEqual(result1.keys(), ["x"])
395398
self.assertEqual(result2.keys(), ["x"])
396399
if invert_fetching:
@@ -419,13 +422,15 @@ def _test():
419422
if run_q2_before_q1_fetch:
420423
result2 = tx.run("UNWIND [5,6,7,8] AS y RETURN y")
421424

422-
if self.driver_supports_features(types.Feature.TMP_RESULT_KEYS):
425+
if get_driver_name() not in ["dotnet"]:
426+
# missing former types.Feature.TMP_RESULT_KEYS
423427
self.assertEqual(result1.keys(), ["x"])
424428
values1 = [result1.next().values[0]]
425429

426430
if not run_q2_before_q1_fetch:
427431
result2 = tx.run("UNWIND [5,6,7,8] AS y RETURN y")
428-
if self.driver_supports_features(types.Feature.TMP_RESULT_KEYS):
432+
if get_driver_name() not in ["dotnet"]:
433+
# missing former types.Feature.TMP_RESULT_KEYS
429434
self.assertEqual(result2.keys(), ["y"])
430435
values2 = list(map(lambda rec: rec.values[0], result2))
431436

tests/stub/routing/test_no_routing_v3.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from nutkit import protocol as types
2-
3-
from .test_no_routing_v4x1 import NoRoutingV4x1
2+
from tests.stub.routing.test_no_routing_v4x1 import NoRoutingV4x1
43

54

65
class NoRoutingV3(NoRoutingV4x1):

tests/stub/routing/test_no_routing_v4x1.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ def test_should_error_on_rollback_failure_using_tx_rollback(self):
185185
self._server.address])
186186
self._server.done()
187187

188-
@driver_feature(types.Feature.TMP_TRANSACTION_CLOSE)
189188
def test_should_error_on_rollback_failure_using_tx_close(self):
190189
uri = "bolt://%s" % self._server.address
191190
self._server.start(
@@ -252,7 +251,6 @@ def test_should_error_on_rollback_failure_using_session_close(
252251
self._server.address])
253252
self._server.done()
254253

255-
@driver_feature(types.Feature.TMP_DRIVER_FETCH_SIZE)
256254
def test_should_accept_custom_fetch_size_using_driver_configuration(
257255
self):
258256
uri = "bolt://%s" % self._server.address
@@ -338,7 +336,6 @@ def test_should_pull_custom_size_and_then_all_using_session_configuration(
338336
for i in (1, 3, 5, 7, 9)])
339337
self._server.done()
340338

341-
@driver_feature(types.Feature.TMP_DRIVER_FETCH_SIZE)
342339
def test_should_pull_all_when_fetch_is_minus_one_using_driver_configuration( # noqa: E501
343340
self):
344341
uri = "bolt://%s" % self._server.address

tests/stub/routing/test_routing_v3.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from nutkit.frontend import Driver
22
import nutkit.protocol as types
3-
4-
from ...shared import get_driver_name
5-
from .test_routing_v4x4 import RoutingV4x4
3+
from tests.shared import get_driver_name
4+
from tests.stub.routing.test_routing_v4x4 import RoutingV4x4
65

76

87
class RoutingV3(RoutingV4x4):

tests/stub/routing/test_routing_v4x1.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
from nutkit import protocol as types
44
from nutkit.frontend import Driver
5-
6-
from .test_routing_v4x4 import RoutingV4x4
5+
from tests.stub.routing.test_routing_v4x4 import RoutingV4x4
76

87

98
class RoutingV4x1(RoutingV4x4):

tests/stub/routing/test_routing_v4x3.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import nutkit.protocol as types
22
from tests.shared import driver_feature
3-
4-
from .test_routing_v4x4 import RoutingV4x4
3+
from tests.stub.routing.test_routing_v4x4 import RoutingV4x4
54

65

76
class RoutingV4x3(RoutingV4x4):

0 commit comments

Comments
 (0)