diff --git a/tests/stub/routing/scripts/v3/router_yielding_argument_error.script b/tests/stub/routing/scripts/v3/router_yielding_argument_error.script new file mode 100644 index 000000000..9a90e1351 --- /dev/null +++ b/tests/stub/routing/scripts/v3/router_yielding_argument_error.script @@ -0,0 +1,13 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007"#EXTR_HELLO_ROUTING_PROPS#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": #ROUTINGCTX#} {"[mode]": "r"} +S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom."} +{? + C: PULL_ALL + S: IGNORED +?} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v3/router_yielding_invalid_request.script b/tests/stub/routing/scripts/v3/router_yielding_invalid_request.script new file mode 100644 index 000000000..69e65b384 --- /dev/null +++ b/tests/stub/routing/scripts/v3/router_yielding_invalid_request.script @@ -0,0 +1,13 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007"#EXTR_HELLO_ROUTING_PROPS#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": #ROUTINGCTX#} {"[mode]": "r"} +S: FAILURE {"code": "Neo.ClientError.Request.Invalid", "message": "Kaboooom."} +{? + C: PULL_ALL + S: IGNORED +?} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v3/router_yielding_type_error.script b/tests/stub/routing/scripts/v3/router_yielding_type_error.script new file mode 100644 index 000000000..46fb68235 --- /dev/null +++ b/tests/stub/routing/scripts/v3/router_yielding_type_error.script @@ -0,0 +1,13 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007"#EXTR_HELLO_ROUTING_PROPS#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": #ROUTINGCTX#} {"[mode]": "r"} +S: FAILURE {"code": "Neo.ClientError.Statement.TypeError", "message": "Kaboooom."} +{? + C: PULL_ALL + S: IGNORED +?} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x1/router_yielding_argument_error.script b/tests/stub/routing/scripts/v4x1/router_yielding_argument_error.script new file mode 100644 index 000000000..e0eb640ac --- /dev/null +++ b/tests/stub/routing/scripts/v4x1/router_yielding_argument_error.script @@ -0,0 +1,13 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "[database]": "*"} {"[mode]": "r", "db": "system", "bookmarks": ["foobar"]} +S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom."} +{? + C: PULL {"n": {"Z": "*"}} + S: IGNORED +?} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x1/router_yielding_invalid_request.script b/tests/stub/routing/scripts/v4x1/router_yielding_invalid_request.script new file mode 100644 index 000000000..880e2b03d --- /dev/null +++ b/tests/stub/routing/scripts/v4x1/router_yielding_invalid_request.script @@ -0,0 +1,13 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "[database]": "*"} {"[mode]": "r", "db": "system", "bookmarks": ["foobar"]} +S: FAILURE {"code": "Neo.ClientError.Request.Invalid", "message": "Kaboooom."} +{? + C: PULL {"n": {"Z": "*"}} + S: IGNORED +?} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x1/router_yielding_type_error.script b/tests/stub/routing/scripts/v4x1/router_yielding_type_error.script new file mode 100644 index 000000000..3f922966b --- /dev/null +++ b/tests/stub/routing/scripts/v4x1/router_yielding_type_error.script @@ -0,0 +1,13 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "[database]": "*"} {"[mode]": "r", "db": "system", "bookmarks": ["foobar"]} +S: FAILURE {"code": "Neo.ClientError.Statement.TypeError", "message": "Kaboooom."} +{? + C: PULL {"n": {"Z": "*"}} + S: IGNORED +?} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x3/router_yielding_argument_error.script b/tests/stub/routing/scripts/v4x3/router_yielding_argument_error.script new file mode 100644 index 000000000..d490c0e4c --- /dev/null +++ b/tests/stub/routing/scripts/v4x3/router_yielding_argument_error.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX# , "[patch_bolt]": "*"} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] "*" +S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom!"} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x3/router_yielding_invalid_request.script b/tests/stub/routing/scripts/v4x3/router_yielding_invalid_request.script new file mode 100644 index 000000000..62db324cb --- /dev/null +++ b/tests/stub/routing/scripts/v4x3/router_yielding_invalid_request.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX# , "[patch_bolt]": "*"} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] "*" +S: FAILURE {"code": "Neo.ClientError.Request.Invalid", "message": "Kaboooom!"} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x3/router_yielding_type_error.script b/tests/stub/routing/scripts/v4x3/router_yielding_type_error.script new file mode 100644 index 000000000..e4641273e --- /dev/null +++ b/tests/stub/routing/scripts/v4x3/router_yielding_type_error.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX# , "[patch_bolt]": "*"} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] "*" +S: FAILURE {"code": "Neo.ClientError.Statement.TypeError", "message": "Kaboooom!"} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x4/router_yielding_argument_error.script b/tests/stub/routing/scripts/v4x4/router_yielding_argument_error.script new file mode 100644 index 000000000..1938be3d2 --- /dev/null +++ b/tests/stub/routing/scripts/v4x4/router_yielding_argument_error.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#, "[patch_bolt]": "*"} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] {"[db]": "*"} +S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom."} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x4/router_yielding_invalid_request.script b/tests/stub/routing/scripts/v4x4/router_yielding_invalid_request.script new file mode 100644 index 000000000..f9aff1b03 --- /dev/null +++ b/tests/stub/routing/scripts/v4x4/router_yielding_invalid_request.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#, "[patch_bolt]": "*"} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] {"[db]": "*"} +S: FAILURE {"code": "Neo.ClientError.Request.Invalid", "message": "Kaboooom."} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v4x4/router_yielding_type_error.script b/tests/stub/routing/scripts/v4x4/router_yielding_type_error.script new file mode 100644 index 000000000..6bb55df8a --- /dev/null +++ b/tests/stub/routing/scripts/v4x4/router_yielding_type_error.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#, "[patch_bolt]": "*"} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] {"[db]": "*"} +S: FAILURE {"code": "Neo.ClientError.Statement.TypeError", "message": "Kaboooom."} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v5x0/router_yielding_argument_error.script b/tests/stub/routing/scripts/v5x0/router_yielding_argument_error.script new file mode 100644 index 000000000..2fdd7f5bd --- /dev/null +++ b/tests/stub/routing/scripts/v5x0/router_yielding_argument_error.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] {"[db]": "*"} +S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom."} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v5x0/router_yielding_invalid_request.script b/tests/stub/routing/scripts/v5x0/router_yielding_invalid_request.script new file mode 100644 index 000000000..7e5f9f351 --- /dev/null +++ b/tests/stub/routing/scripts/v5x0/router_yielding_invalid_request.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] {"[db]": "*"} +S: FAILURE {"code": "Neo.ClientError.Request.Invalid", "message": "Kaboooom."} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/scripts/v5x0/router_yielding_type_error.script b/tests/stub/routing/scripts/v5x0/router_yielding_type_error.script new file mode 100644 index 000000000..49b97c6b4 --- /dev/null +++ b/tests/stub/routing/scripts/v5x0/router_yielding_type_error.script @@ -0,0 +1,9 @@ +!: BOLT #VERSION# + +C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#} +S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"} +*: RESET +C: ROUTE #ROUTINGCTX# ["foobar"] {"[db]": "*"} +S: FAILURE {"code": "Neo.ClientError.Statement.TypeError", "message": "Kaboooom."} +*: RESET +?: GOODBYE diff --git a/tests/stub/routing/test_routing_v5x0.py b/tests/stub/routing/test_routing_v5x0.py index b5f3493e8..fc283f6ec 100644 --- a/tests/stub/routing/test_routing_v5x0.py +++ b/tests/stub/routing/test_routing_v5x0.py @@ -2306,6 +2306,36 @@ def test_should_fail_with_routing_failure_on_any_security_discovery_failure( # exc.exception.code ) + def test_should_fail_with_invalid_route_statement_argument(self): + exc = self._test_fast_fail_discover( + "router_yielding_argument_error.script", + ) + + self.assertEqual( + "Neo.ClientError.Statement.ArgumentError", + exc.exception.code + ) + + def test_should_fail_with_invalid_routing_request(self): + exc = self._test_fast_fail_discover( + "router_yielding_invalid_request.script", + ) + + self.assertEqual( + "Neo.ClientError.Request.Invalid", + exc.exception.code + ) + + def test_should_fail_with_type_error_request(self): + exc = self._test_fast_fail_discover( + "router_yielding_type_error.script", + ) + + self.assertEqual( + "Neo.ClientError.Statement.TypeError", + exc.exception.code + ) + def test_should_read_successfully_from_reachable_db_after_trying_unreachable_db( # noqa: E501 self ):