Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: debug #66

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
- 3-nodes-transfer
- invoice-ops
- open-use-close-a-channel
- playground
release:
- "0.116.1"
name: e2e test for ${{ matrix.workflow }}
Expand Down
38 changes: 38 additions & 0 deletions tests/bruno/e2e/playground/1/01-connect-peer.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
meta {
name: connect peer
type: http
seq: 1
}

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": "connect_peer",
"params": [
{"address": "{{NODE1_ADDR}}"}
]
}
}

assert {
res.body.error: isUndefined
res.body.result: isNull
}

script:post-response {
// Dialing a peer is async in tentacle. Sleep for some time to make sure
// we're connected to the peer.
await new Promise(r => setTimeout(r, 1000));
}
40 changes: 40 additions & 0 deletions tests/bruno/e2e/playground/1/02-open-channel.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
meta {
name: open a channel to a peer
type: http
seq: 2
}

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": "open_channel",
"params": [
{
"peer_id": "{{NODE1_PEERID}}",
"funding_amount": "0xba43b7400"
}
]
}
}

assert {
res.body.error: isUndefined
res.body.result.temporary_channel_id: isDefined
}

script:post-response {
await new Promise(r => setTimeout(r, 1000));
bru.setVar("TEMP_CHANNEL_ID", res.body.result.temporary_channel_id);
}
41 changes: 41 additions & 0 deletions tests/bruno/e2e/playground/1/03-get-auto-accepted-channel.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
meta {
name: get auto accepted channel id from Node1
type: http
seq: 3
}

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": "list_channels",
"params": [
{
"peer_id": "{{NODE3_PEERID}}"
}
]
}
}

assert {
res.body.error: isUndefined
res.body.result.channels: isDefined
}

script:post-response {
console.log(res.body.result);
// Sleep for sometime to make sure current operation finishes before next request starts.
await new Promise(r => setTimeout(r, 2000));
bru.setVar("CHANNEL_ID", res.body.result.channels[0].channel_id);
}
56 changes: 56 additions & 0 deletions tests/bruno/e2e/playground/1/06-generate-a-few-blocks.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
meta {
name: generate a few blocks
type: http
seq: 6
}

post {
url: {{CKB_RPC_URL}}
body: json
auth: none
}

headers {
Content-Type: application/json
Accept: application/json
}

body:json {
{
"id": {{iteration}},
"jsonrpc": "2.0",
"method": "generate_block",
"params": []
}
}

vars:post-response {
max_iterations: 50
}

assert {
res.status: eq 200
}

script:pre-request {
// Script taken from https://github.com/usebruno/bruno/discussions/385#discussioncomment-8015350
// This does not seem to work.
if(bru.getVar("iteration") === undefined){
console.log("Started generating blocks...");
bru.setVar("iteration", 0);
}
}

script:post-response {
if(bru.getVar("iteration") < bru.getVar("max_iterations") -1){
bru.setVar("iteration", bru.getVar("iteration") + 1);
// This is the name of this bruno file, set this to continue generating blocks.
bru.setNextRequest("generate a few blocks");
} else {
console.log("Stopping generating blocks");
// Don't know why it takes so long for funding transaction to be confirmed.
await new Promise(r => setTimeout(r, 5000));
}
await new Promise(r => setTimeout(r, 10));
console.log("Generated the " + bru.getVar("iteration") + "th block");
}
43 changes: 43 additions & 0 deletions tests/bruno/e2e/playground/1/07-add-tlc-from-NODE3.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
meta {
name: add tlc from NODE3
type: http
seq: 7
}

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": "add_tlc",
"params": [
{
"channel_id": "{{CHANNEL_ID}}",
"amount": "0x5f5e100",
"payment_hash": "0x266cec97cbede2cfbce73666f08deed9560bdf7841a7a5a51b3a3f09da249e21",
"expiry": 40
}
]
}
}

assert {
res.body.error: isUndefined
res.body.result.tlc_id: isDefined
}

script:post-response {
// Sleep for sometime to make sure current operation finishes before next request starts.
await new Promise(r => setTimeout(r, 1000));
bru.setVar("TLC_ID1", res.body.result.tlc_id);
}
39 changes: 39 additions & 0 deletions tests/bruno/e2e/playground/1/08-commitment-signed-NODE3.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
meta {
name: send commitment_signed message from NODE3
type: http
seq: 8
}

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": "commitment_signed",
"params": [
{
"channel_id": "{{CHANNEL_ID}}"
}
]
}
}

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, 1000));
}
39 changes: 39 additions & 0 deletions tests/bruno/e2e/playground/1/09-commitment-signed-NODE1.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
meta {
name: send commitment_signed message from NODE1
type: http
seq: 09
}

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": "commitment_signed",
"params": [
{
"channel_id": "{{CHANNEL_ID}}"
}
]
}
}

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, 1000));
}
43 changes: 43 additions & 0 deletions tests/bruno/e2e/playground/1/10-remove-tlc-from-NODE1.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
meta {
name: remove tlc from NODE1
type: http
seq: 10
}

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": "remove_tlc",
"params": [
{
"channel_id": "{{CHANNEL_ID}}",
"tlc_id": "{{TLC_ID1}}",
"reason": {
"payment_preimage": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
}
]
}
}

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, 1000));
}
39 changes: 39 additions & 0 deletions tests/bruno/e2e/playground/1/11-commitment-signed-NODE1.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
meta {
name: send commitment_signed message from NODE1
type: http
seq: 11
}

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": "commitment_signed",
"params": [
{
"channel_id": "{{CHANNEL_ID}}"
}
]
}
}

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, 1000));
}
Loading
Loading