-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
tests/bruno/e2e/cross-chain-hub/13-node1-send-shutdown-channel.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,45 @@ | ||
meta { | ||
name: 13-node1-send-shutdown-channel | ||
type: http | ||
seq: 13 | ||
} | ||
|
||
post { | ||
url: {{NODE1_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": "42", | ||
"jsonrpc": "2.0", | ||
"method": "shutdown_channel", | ||
"params": [ | ||
{ | ||
"channel_id": "{{N1N3_CHANNEL_ID}}", | ||
"close_script": { | ||
"code_hash": "0x2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a", | ||
"hash_type": "data", | ||
"args": "0x0101010101010101010101010101010101010101" | ||
}, | ||
"fee_rate": "0x3FC" | ||
} | ||
] | ||
} | ||
} | ||
|
||
assert { | ||
res.body.error: isUndefined | ||
res.body.result: isNull | ||
} | ||
|
||
script:post-response { | ||
// Sleep for sometime to make sure current operation finishes before next request starts. | ||
await new Promise(r => setTimeout(r, 100)); | ||
} |
40 changes: 40 additions & 0 deletions
40
tests/bruno/e2e/cross-chain-hub/14-node3-send-shutdown-channel.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,40 @@ | ||
meta { | ||
name: 14-node3-send-shutdown-channel | ||
type: http | ||
seq: 14 | ||
} | ||
|
||
post { | ||
url: {{NODE1_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": "42", | ||
"jsonrpc": "2.0", | ||
"method": "shutdown_channel", | ||
"params": [ | ||
{ | ||
"channel_id": "{{N1N3_CHANNEL_ID}}", | ||
"close_script": { | ||
"code_hash": "0x2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a", | ||
"hash_type": "data", | ||
"args": "0x0303030303030303030303030303030303030303" | ||
}, | ||
"fee_rate": "0x3FC" | ||
} | ||
] | ||
} | ||
} | ||
|
||
script:post-response { | ||
// Sleep for sometime to make sure current operation finishes before next request starts. | ||
await new Promise(r => setTimeout(r, 100)); | ||
} |
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,35 @@ | ||
meta { | ||
name: 15-node3-list-channel | ||
type: http | ||
seq: 15 | ||
} | ||
|
||
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}}" | ||
} | ||
] | ||
} | ||
} | ||
|
||
assert { | ||
res.body.error: isUndefined | ||
res.body.result.channels: isDefined | ||
res.body.result.channels.map(channel => channel.channel_id): notContains {{N1N3_CHANNEL_ID}} | ||
} |
20 changes: 20 additions & 0 deletions
20
tests/bruno/e2e/cross-chain-hub/16-node1-list-ln-channel.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,20 @@ | ||
meta { | ||
name: 16-node1-list-ln-channel | ||
type: http | ||
seq: 16 | ||
} | ||
|
||
get { | ||
url: {{LND_BOB_RPC_URL}}/v1/channels | ||
body: json | ||
auth: none | ||
} | ||
|
||
assert { | ||
res.body.channels: length 1 | ||
} | ||
|
||
script:post-response { | ||
console.log("list ln channel result: ", res.body); | ||
bru.setVar("LN_CHANNEL_ID", res.body.channels[0].channel_point.replace(":", "/")); | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/bruno/e2e/cross-chain-hub/17-node1-close-ln-channel.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: 17-node1-close-ln-channel | ||
type: http | ||
seq: 17 | ||
} | ||
|
||
delete { | ||
url: {{LND_BOB_RPC_URL}}/v1/channels/{{LN_CHANNEL_ID}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
script:pre-request { | ||
const axios = require('axios'); | ||
|
||
const url = bru.getEnvVar("LND_BOB_RPC_URL") + "/v1/channels/" + bru.getVar("LN_CHANNEL_ID"); | ||
console.log(url); | ||
|
||
const resp = await axios({ | ||
method: 'DELETE', | ||
url: url, | ||
responseType: 'stream' | ||
}); | ||
resp.data.destroy(); | ||
} | ||
|
||
assert { | ||
res.status: eq 500 | ||
} | ||
|
||
docs { | ||
This is a server-streaming RPC which will block Bruno. The workaround is sending the request in the pre-script so the Bruno request will return 500 because the channel is already closed. | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/bruno/e2e/cross-chain-hub/18-node1-list-ln-channel.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,19 @@ | ||
meta { | ||
name: 18-node1-list-ln-channel | ||
type: http | ||
seq: 18 | ||
} | ||
|
||
get { | ||
url: {{LND_BOB_RPC_URL}}/v1/channels | ||
body: json | ||
auth: none | ||
} | ||
|
||
assert { | ||
res.body.channels: length 0 | ||
} | ||
|
||
script:post-response { | ||
console.log("list channel result: ", res.body); | ||
} |