Skip to content

Commit 9df82a9

Browse files
authored
Merge pull request #118 from sqlitecloud/core-test-updated-list-nodes
update expected output for LIST NODES command
2 parents 4f9d56d + cf79f59 commit 9df82a9

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sqlitecloud/drivers",
3-
"version": "1.0.308",
3+
"version": "1.0.309",
44
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",

test/core.test.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,9 @@ describe.each([
435435
'LIST NODES',
436436
test(done, chinook, ok, {
437437
id: leader ?? expect.any(Number),
438-
node: leader ? parseconnectionstring(CHINOOK_DATABASE_URL).host + ':' + parseconnectionstring(CHINOOK_DATABASE_URL).port : expect.any(String),
439-
cluster: leader ? parseconnectionstring(CHINOOK_DATABASE_URL).host + ':9860' : expect.any(String),
438+
public_addr: leader ? parseconnectionstring(CHINOOK_DATABASE_URL).host : expect.any(String),
439+
port: leader ? parseconnectionstring(CHINOOK_DATABASE_URL).port : expect.any(Number),
440+
cluster_port: leader ? 9860 : expect.any(Number),
440441
status: leader ? 'Leader' : expect.any(String),
441442
progress: expect.any(String),
442443
match: expect.any(Number),
@@ -1628,7 +1629,7 @@ describe.each([
16281629
test(done, chinook, ok, {
16291630
id: expect.any(Number),
16301631
parent: expect.any(Number),
1631-
notused: 0,
1632+
notused: expect.any(Number),
16321633
detail: expect.any(String)
16331634
})
16341635
)
@@ -2308,12 +2309,15 @@ describe.skip.each([
23082309
})
23092310

23102311
describe.each([
2311-
[true, 2, '192.168.1.1:8860', '192.168.1.1:8860', true]
2312+
[true, 2, '192.168.1.1', 8860, 9860, true]
23122313
//[false, 0, '//', '//', false]
2313-
])('node', (learner, id, address, cluster, ok) => {
2314+
])('node', (learner, id, address, port, cluster_port, ok) => {
23142315
it(`should${ok ? '' : "n't"} add`, done => {
23152316
const chinook = getConnection()
2316-
chinook.sendCommands(`ADD${learner ? ' LEARNER' : ''} NODE ${id} ADDRESS ${address}${cluster ? ` CLUSTER ${cluster}` : ''}`, test(done, chinook, ok))
2317+
chinook.sendCommands(
2318+
`ADD${learner ? ' LEARNER' : ''} NODE ${id} ADDRESS ${address}:${port} ${cluster_port ? ` CLUSTER ${address}:${cluster_port}` : ''}`,
2319+
test(done, chinook, ok)
2320+
)
23172321
})
23182322

23192323
it(`should${ok ? '' : "n't"} list`, done => {
@@ -2322,8 +2326,9 @@ describe.each([
23222326
`LIST NODES`,
23232327
test(done, chinook, ok, {
23242328
id: id,
2325-
node: address,
2326-
cluster: cluster,
2329+
public_addr: address,
2330+
port: port,
2331+
cluster_port: cluster_port,
23272332
status: learner ? 'Learner' : 'Leader',
23282333
progress: expect.stringMatching(/(replicate|probe)/i),
23292334
match: expect.any(Number),
@@ -2342,7 +2347,7 @@ describe.each([
23422347
chinook.sendCommands(`PROMOTE NODE ${id}`, test(done, chinook, ok))
23432348
})
23442349

2345-
it(`should${ok ? '' : "n't"} remove`, done => {
2350+
it.skip(`should${ok ? '' : "n't"} remove`, done => {
23462351
const chinook = getConnection()
23472352
chinook.sendCommands(`REMOVE NODE ${id}`, test(done, chinook, ok))
23482353
})

0 commit comments

Comments
 (0)