Skip to content

Commit

Permalink
Merge pull request #118 from sqlitecloud/core-test-updated-list-nodes
Browse files Browse the repository at this point in the history
update expected output for LIST NODES command
  • Loading branch information
Gioee authored Nov 5, 2024
2 parents 4f9d56d + cf79f59 commit 9df82a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sqlitecloud/drivers",
"version": "1.0.308",
"version": "1.0.309",
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
23 changes: 14 additions & 9 deletions test/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,9 @@ describe.each([
'LIST NODES',
test(done, chinook, ok, {
id: leader ?? expect.any(Number),
node: leader ? parseconnectionstring(CHINOOK_DATABASE_URL).host + ':' + parseconnectionstring(CHINOOK_DATABASE_URL).port : expect.any(String),
cluster: leader ? parseconnectionstring(CHINOOK_DATABASE_URL).host + ':9860' : expect.any(String),
public_addr: leader ? parseconnectionstring(CHINOOK_DATABASE_URL).host : expect.any(String),
port: leader ? parseconnectionstring(CHINOOK_DATABASE_URL).port : expect.any(Number),
cluster_port: leader ? 9860 : expect.any(Number),
status: leader ? 'Leader' : expect.any(String),
progress: expect.any(String),
match: expect.any(Number),
Expand Down Expand Up @@ -1628,7 +1629,7 @@ describe.each([
test(done, chinook, ok, {
id: expect.any(Number),
parent: expect.any(Number),
notused: 0,
notused: expect.any(Number),
detail: expect.any(String)
})
)
Expand Down Expand Up @@ -2308,12 +2309,15 @@ describe.skip.each([
})

describe.each([
[true, 2, '192.168.1.1:8860', '192.168.1.1:8860', true]
[true, 2, '192.168.1.1', 8860, 9860, true]
//[false, 0, '//', '//', false]
])('node', (learner, id, address, cluster, ok) => {
])('node', (learner, id, address, port, cluster_port, ok) => {
it(`should${ok ? '' : "n't"} add`, done => {
const chinook = getConnection()
chinook.sendCommands(`ADD${learner ? ' LEARNER' : ''} NODE ${id} ADDRESS ${address}${cluster ? ` CLUSTER ${cluster}` : ''}`, test(done, chinook, ok))
chinook.sendCommands(
`ADD${learner ? ' LEARNER' : ''} NODE ${id} ADDRESS ${address}:${port} ${cluster_port ? ` CLUSTER ${address}:${cluster_port}` : ''}`,
test(done, chinook, ok)
)
})

it(`should${ok ? '' : "n't"} list`, done => {
Expand All @@ -2322,8 +2326,9 @@ describe.each([
`LIST NODES`,
test(done, chinook, ok, {
id: id,
node: address,
cluster: cluster,
public_addr: address,
port: port,
cluster_port: cluster_port,
status: learner ? 'Learner' : 'Leader',
progress: expect.stringMatching(/(replicate|probe)/i),
match: expect.any(Number),
Expand All @@ -2342,7 +2347,7 @@ describe.each([
chinook.sendCommands(`PROMOTE NODE ${id}`, test(done, chinook, ok))
})

it(`should${ok ? '' : "n't"} remove`, done => {
it.skip(`should${ok ? '' : "n't"} remove`, done => {
const chinook = getConnection()
chinook.sendCommands(`REMOVE NODE ${id}`, test(done, chinook, ok))
})
Expand Down

0 comments on commit 9df82a9

Please sign in to comment.