-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix failed test caused by channel closed status change
- Loading branch information
1 parent
a6d6618
commit b8700af
Showing
4 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
tests/bruno/e2e/open-use-close-a-channel/21-list-channel-with-closed-status-NODE1.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
meta { | ||
name: get channels from node1 | ||
type: http | ||
seq: 21 | ||
} | ||
|
||
post { | ||
url: {{NODE3_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": 42, | ||
"jsonrpc": "2.0", | ||
"method": "list_channels", | ||
"params": [ | ||
{ | ||
"peer_id": "{{NODE1_PEERID}}", | ||
"include_closed": true | ||
} | ||
] | ||
} | ||
} | ||
|
||
script:pre-request { | ||
await new Promise(r => setTimeout(r, 2000)); | ||
} | ||
|
||
assert { | ||
res.status: eq 200 | ||
} | ||
|
||
script:post-response { | ||
await new Promise(r => setTimeout(r, 1000)); | ||
console.log("step 21 list channels: ", res.body.result.channels); | ||
// should list all channels including the closed one | ||
let channel = res.body.result.channels[0]; | ||
console.log("channel: ", channel); | ||
let expect_channel_id = bru.getVar("CHANNEL_ID"); | ||
console.log("expect_channel_id: ", expect_channel_id); | ||
if (!channel || channel.channel_id != expect_channel_id) { | ||
throw new Error("channel not found"); | ||
} | ||
if (channel.state.state_name != "SHUTTING_DOWN" && channel.state.state_flags != "WAITING_COMMITMENT_CONFIRMATION") { | ||
throw new Error("channel state is not right"); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/bruno/e2e/open-use-close-a-channel/22-generate-a-few-blocks.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
meta { | ||
name: generate a few epochs | ||
type: http | ||
seq: 22 | ||
} | ||
|
||
post { | ||
url: {{CKB_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": 42, | ||
"jsonrpc": "2.0", | ||
"method": "generate_epochs", | ||
"params": ["0x2"] | ||
} | ||
} | ||
|
||
assert { | ||
res.status: eq 200 | ||
} | ||
|
||
script:post-response { | ||
await new Promise(r => setTimeout(r, 5000)); | ||
} |
54 changes: 54 additions & 0 deletions
54
tests/bruno/e2e/open-use-close-a-channel/23-list-channel-with-closed-status-NODE1.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
meta { | ||
name: get channels from node1 | ||
type: http | ||
seq: 23 | ||
} | ||
|
||
post { | ||
url: {{NODE3_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": 42, | ||
"jsonrpc": "2.0", | ||
"method": "list_channels", | ||
"params": [ | ||
{ | ||
"peer_id": "{{NODE1_PEERID}}", | ||
"include_closed": true | ||
} | ||
] | ||
} | ||
} | ||
|
||
script:pre-request { | ||
await new Promise(r => setTimeout(r, 2000)); | ||
} | ||
|
||
assert { | ||
res.status: eq 200 | ||
} | ||
|
||
script:post-response { | ||
await new Promise(r => setTimeout(r, 1000)); | ||
console.log("step 23 list channels: ", res.body.result.channels); | ||
// should list all channels including the closed one | ||
let channel = res.body.result.channels[0]; | ||
console.log("channel: ", channel); | ||
let expect_channel_id = bru.getVar("CHANNEL_ID"); | ||
console.log("expect_channel_id: ", expect_channel_id); | ||
if (!channel || channel.channel_id != expect_channel_id) { | ||
throw new Error("channel not found"); | ||
} | ||
if (channel.state.state_name != "CLOSED" && channel.state.state_flags != "COOPERATIVE") { | ||
throw new Error("channel state is not right"); | ||
} | ||
} |