Skip to content

Test writers are removed from RTs per database #590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions boltstub/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,6 @@ def can_be_skipped(self, channel):


class ConditionalBlock(Block):

def __init__(self, conditions: List[str], blocks: List[Block],
line_number: int):
super().__init__(line_number)
Expand Down Expand Up @@ -1120,7 +1119,7 @@ def can_consume_after_reset(self, channel) -> bool:
block = self._probe_selection(channel, None)
if not block:
return False
return block.can_consume(channel)
return block.can_consume_after_reset(channel)
pass

def has_deterministic_end(self):
Expand Down
21 changes: 21 additions & 0 deletions tests/stub/routing/scripts/v3/router_adb_then_bdb.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
!: BOLT #VERSION#
!: AUTO RESET
!: ALLOW RESTART
!: PY request = 0

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
{*
IF: request < 2
{{
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": #ROUTINGCTX#} {"[mode]": "r"}
S: SUCCESS {"fields": ["ttl", "servers"]}
C: PULL_ALL
S: RECORD [1000, [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]]
SUCCESS {"type": "r"}
PY: request += 1
*: RESET
}}
*}
?: GOODBYE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
!: BOLT #VERSION#

A: HELLO {"{}": "*"}
*: RESET

C: RUN "RETURN 1 AS n" {} {}
S: SUCCESS {"fields": ["n"]}
C: PULL_ALL
S: RECORD [1]
SUCCESS {"type": "r"}

*: RESET

C: BEGIN {}
S: SUCCESS {}
C: RUN "RETURN 1 AS n" {} {}
S: FAILURE #FAILURE#
{?
C: PULL_ALL
S: IGNORED
?}
C: RESET
S: SUCCESS {}

*: RESET
?: GOODBYE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
!: BOLT #VERSION#

A: HELLO {"{}": "*"}
*: RESET

C: RUN "RETURN 1 AS n" {} {}
S: SUCCESS {"fields": ["n"]}
C: PULL_ALL
S: RECORD [1]
SUCCESS {"type": "r"}

*: RESET

C: RUN "RETURN 1 AS n" {} {}
S: FAILURE #FAILURE#
{?
C: PULL_ALL
S: IGNORED
?}
C: RESET
S: SUCCESS {}

*: RESET
?: GOODBYE

This file was deleted.

38 changes: 38 additions & 0 deletions tests/stub/routing/scripts/v4x1/router_adb_then_bdb.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
!: BOLT #VERSION#
!: AUTO RESET
!: ALLOW RESTART
!: PY request = 0

C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#}
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
*: RESET
IF: request == 0
{{
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "database": "adb"} {"[mode]": "r", "db": "system", "[bookmarks]": "*"}
S: SUCCESS {"fields": ["ttl", "servers"]}
C: PULL {"n": -1}
S: RECORD [1000, [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]]
SUCCESS {"type": "r"}
PY: request = 1
*: RESET
{?
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "database": "bdb"} {"[mode]": "r", "db": "system", "[bookmarks]": "*"}
S: SUCCESS {"fields": ["ttl", "servers"]}
C: PULL {"n": -1}
S: RECORD [1000, [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]]
SUCCESS {"type": "r"}
PY: request = 2
*: RESET
?}
}}
ELIF: request == 1
{{
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "database": "bdb"} {"[mode]": "r", "db": "system", "[bookmarks]": "*"}
S: SUCCESS {"fields": ["ttl", "servers"]}
C: PULL {"n": -1}
S: RECORD [1000, [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]]
SUCCESS {"type": "r"}
PY: request = 2
*: RESET
}}
?: GOODBYE
29 changes: 29 additions & 0 deletions tests/stub/routing/scripts/v4x3/router_adb_then_bdb.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
!: BOLT #VERSION#
!: AUTO RESET
!: ALLOW RESTART
!: PY request = 0

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
IF: request == 0
{{
C: ROUTE #ROUTINGCTX# "*" "adb"
S: SUCCESS { "rt": { "ttl": 1000, "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 1
*: RESET
{?
C: ROUTE #ROUTINGCTX# "*" "bdb"
S: SUCCESS { "rt": { "ttl": 1000, "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 2
*: RESET
?}
}}
ELIF: request == 1
{{
C: ROUTE #ROUTINGCTX# "*" "bdb"
S: SUCCESS { "rt": { "ttl": 1000, "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 2
*: RESET
}}
?: GOODBYE
29 changes: 29 additions & 0 deletions tests/stub/routing/scripts/v4x4/router_adb_then_bdb.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
!: BOLT #VERSION#
!: AUTO RESET
!: ALLOW RESTART
!: PY request = 0

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
IF: request == 0
{{
C: ROUTE #ROUTINGCTX# "*" {"db": "adb"}
S: SUCCESS { "rt": { "ttl": 1000, "db": "adb", "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 1
*: RESET
{?
C: ROUTE #ROUTINGCTX# "*" {"db": "bdb"}
S: SUCCESS { "rt": { "ttl": 1000, "db": "bdb", "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 2
*: RESET
?}
}}
ELIF: request == 1
{{
C: ROUTE #ROUTINGCTX# "*" {"db": "bdb"}
S: SUCCESS { "rt": { "ttl": 1000, "db": "bdb", "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 2
*: RESET
}}
?: GOODBYE
29 changes: 29 additions & 0 deletions tests/stub/routing/scripts/v5x0/router_adb_then_bdb.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
!: BOLT #VERSION#
!: AUTO RESET
!: ALLOW RESTART
!: PY request = 0

C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#}
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
*: RESET
IF: request == 0
{{
C: ROUTE #ROUTINGCTX# "*" {"db": "adb"}
S: SUCCESS { "rt": { "ttl": 1000, "db": "adb", "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 1
*: RESET
{?
C: ROUTE #ROUTINGCTX# "*" {"db": "bdb"}
S: SUCCESS { "rt": { "ttl": 1000, "db": "bdb", "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 2
*: RESET
?}
}}
ELIF: request == 1
{{
C: ROUTE #ROUTINGCTX# "*" {"db": "bdb"}
S: SUCCESS { "rt": { "ttl": 1000, "db": "bdb", "servers": [{"addresses": ["#HOST#:9000"], "role":"ROUTE"}, {"addresses": ["#HOST#:9010", "#HOST#:9011"], "role":"READ"}, {"addresses": ["#HOST#:9020", "#HOST#:9021"], "role":"WRITE"}]}}
PY: request = 2
*: RESET
}}
?: GOODBYE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
!: BOLT #VERSION#

A: HELLO {"{}": "*"}
*: RESET

C: RUN "RETURN 1 AS n" {} {"db": "adb"}
S: SUCCESS {"fields": ["n"]}
C: PULL {"n": 1000}
S: RECORD [1]
SUCCESS {"type": "r"}

*: RESET

C: BEGIN {"db": "bdb"}
S: SUCCESS {}
C: RUN "RETURN 1 AS n" {} {}
S: FAILURE #FAILURE#
{?
C: PULL {"n": 1000}
S: IGNORED
?}
C: RESET
S: SUCCESS {}

*: RESET
?: GOODBYE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
!: BOLT #VERSION#

A: HELLO {"{}": "*"}
*: RESET

C: RUN "RETURN 1 AS n" {} {"db": "adb"}
S: SUCCESS {"fields": ["n"]}
C: PULL {"n": 1000}
S: RECORD [1]
SUCCESS {"type": "r"}

*: RESET

C: RUN "RETURN 1 AS n" {} {"db": "bdb"}
S: FAILURE #FAILURE#
{?
# Drivers might pipeline RUN and PULL
C: PULL {"n": 1000}
S: IGNORED
?}

*: RESET
?: GOODBYE

This file was deleted.

1 change: 1 addition & 0 deletions tests/stub/routing/test_routing_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def get_vars(self, host=None):
return v

adb = None
bdb = None

def route_call_count(self, server):
return server.count_requests(
Expand Down
Loading