Skip to content

Commit 504f320

Browse files
committed
Migrate bolt stub scripts to Bolt V3
1 parent 7713f53 commit 504f320

File tree

55 files changed

+245
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+245
-177
lines changed

test/internal/node/direct.driver.boltkit.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ describe('direct driver with stub server', () => {
287287

288288
boltStub.run(() => {
289289
const driver = boltStub.newDriver('bolt://127.0.0.1:9001')
290-
const session = driver.session()
290+
const session = driver.session(neo4j.session.READ)
291291
session.run('MATCH (n) RETURN n.name').catch(error => {
292292
expect(error.code).toEqual(neo4j.error.SERVICE_UNAVAILABLE)
293293

test/internal/node/routing.driver.boltkit.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,15 +503,15 @@ describe('routing driver with stub server', () => {
503503
9001
504504
)
505505
const readServer = boltStub.start(
506-
'./test/resources/boltstub/dead_read_server.script',
506+
'./test/resources/boltstub/dead_write_server.script',
507507
9007
508508
)
509509

510510
boltStub.run(() => {
511511
const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001')
512512
// When
513513
const session = driver.session(neo4j.session.WRITE)
514-
session.run('MATCH (n) RETURN n.name').catch(err => {
514+
session.run("CREATE (n {name:'Bob'})").catch(err => {
515515
expect(err.code).toEqual(neo4j.error.SESSION_EXPIRED)
516516
driver.close()
517517
seedServer.exit(code1 => {
@@ -1909,7 +1909,7 @@ describe('routing driver with stub server', () => {
19091909

19101910
boltStub.run(() => {
19111911
const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001')
1912-
const session = driver.session()
1912+
const session = driver.session(neo4j.session.READ)
19131913
session.run('MATCH (n) RETURN n.name AS name').then(result => {
19141914
const names = result.records.map(record => record.get('name'))
19151915
expect(names).toEqual(['Alice', 'Bob', 'Eve'])
@@ -2758,7 +2758,7 @@ describe('routing driver with stub server', () => {
27582758
'./test/resources/boltstub/address_unavailable_template.script.mst'
27592759
const server = boltStub.startWithTemplate(
27602760
serverTemplateScript,
2761-
{ query: query },
2761+
{ query: query, mode: accessMode === READ ? '"mode": "r"' : '' },
27622762
serverPort
27632763
)
27642764

test/resources/boltstub/acquire_endpoints.script

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
5+
!: AUTO GOODBYE
46

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
7+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
68
PULL_ALL
79
S: SUCCESS {"fields": ["ttl", "servers"]}
810
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007","127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]

test/resources/boltstub/acquire_endpoints_and_exit.script

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
5+
!: AUTO GOODBYE
46

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
7+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
68
PULL_ALL
79
S: SUCCESS {"fields": ["ttl", "servers"]}
810
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007","127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]

test/resources/boltstub/acquire_endpoints_v3.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
!: BOLT 3
22
!: AUTO RESET
3+
!: AUTO GOODBYE
34

45
C: HELLO {"scheme": "basic", "principal": "neo4j", "credentials": "password", "user_agent": "neo4j-javascript/0.0.0-dev"}
56
S: SUCCESS {"server": "Neo4j/9.9.9", "connection_id": "bolt-123456789"}

test/resources/boltstub/acquire_endpoints_v3_empty.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
!: BOLT 3
22
!: AUTO HELLO
33
!: AUTO RESET
4+
!: AUTO GOODBYE
45

56
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
67
PULL_ALL

test/resources/boltstub/acquire_endpoints_v3_point_to_empty_router_and_exit.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
!: BOLT 3
22
!: AUTO HELLO
33
!: AUTO RESET
4+
!: AUTO GOODBYE
45

56
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
67
PULL_ALL

test/resources/boltstub/acquire_endpoints_v3_three_servers_and_exit.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
!: BOLT 3
22
!: AUTO HELLO
3+
!: AUTO GOODBYE
34

45
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
56
PULL_ALL

test/resources/boltstub/acquire_endpoints_with_one_of_each.script

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
5+
!: AUTO GOODBYE
46

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
7+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
68
PULL_ALL
79
S: SUCCESS {"fields": ["ttl", "servers"]}
810
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002"], "role": "ROUTE"}]]
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
4-
!: AUTO RUN "ROLLBACK" {}
5-
!: AUTO RUN "BEGIN" {}
6-
!: AUTO RUN "COMMIT" {}
5+
!: AUTO ROLLBACK
6+
!: AUTO BEGIN
7+
!: AUTO COMMIT
8+
!: AUTO GOODBYE
79

8-
C: RUN "{{{query}}}" {}
10+
C: RUN "{{{query}}}" {} { {{{mode}}} }
911
C: PULL_ALL
1012
S: FAILURE {"code": "Neo.TransientError.General.DatabaseUnavailable", "message": "Database is busy doing store copy"}
1113
S: IGNORED

0 commit comments

Comments
 (0)