Skip to content
Permalink
Browse files

docs: adjust E2E tests to new HTTP peering format

  • Loading branch information
gakonst committed Dec 5, 2019
1 parent 591d98c commit ee354752b9da11e679c6d9eb086de537a06bca80
@@ -190,7 +190,7 @@ impl NodeClient<'_> {
let user = args.remove("sender_username").unwrap(); // infallible unwrap
self.client
.post(&format!("{}/accounts/{}/payments", self.url, user))
.bearer_auth(&format!("{}:{}", user, auth))
.bearer_auth(auth)
.json(&args)
.send()
.map_err(Error::SendErr)
@@ -68,6 +68,7 @@ async function run() {
--ilp-over-http-url=https://${config.nodeName}.localtunnel.me/ilp \
--settle-threshold=1000 \
--settle-to=0`)
// TODO: The outgoing token and HTTP url should be replaced with the new format
}

console.log('Using config: ', config)
@@ -19,8 +19,8 @@ The format of the `Authorization` header is either of the following.
- `Bearer admin-token`
- `admin-token` is the token you specified as `admin_auth_token` when you spun up the node.
1. User tokens
- `Bearer username:password`
- `username` and `password` are what you specified as `username` and `ilp_over_http_incoming_token` respectively when you created the account.
- `Bearer password`
- `password` is the token you specified as `ilp_over_http_incoming_token` when you created the account.


## The API
@@ -30,7 +30,7 @@ If you want to just try out the Interledger testnet, you could try as follows.
```bash
curl \
-X POST \
-H "Authorization: Bearer ${username}:${token}" \
-H "Authorization: Bearer ${token}" \
-H "Content-Type: application/json" \
-d '{"receiver":"$their-payment-pointer.example","source_amount":500}' \
https://rs3.xpring.dev/accounts/${Username}/payments
@@ -42,7 +42,7 @@ If someone sends you payments, you could confirm your balance increase as follow

```bash
curl \
-H "Authorization: Bearer ${username}:${token}" \
-H "Authorization: Bearer ${token}" \
https://rs3.xpring.dev/accounts/${Username}/balance
```

@@ -2,10 +2,10 @@
# For integration tests
function post_test_hook() {
if [ $TEST_MODE -eq 1 ]; then
test_equals_or_exit '{"asset_code":"ETH","balance":-5e-16}' test_http_response_body -H "Authorization: Bearer alice:in_alice" http://localhost:7770/accounts/alice/balance
test_equals_or_exit '{"asset_code":"ETH","balance":0.0}' test_http_response_body -H "Authorization: Bearer bob:bob_password" http://localhost:7770/accounts/bob/balance
test_equals_or_exit '{"asset_code":"ETH","balance":0.0}' test_http_response_body -H "Authorization: Bearer alice:alice_password" http://localhost:8770/accounts/alice/balance
test_equals_or_exit '{"asset_code":"ETH","balance":5e-16}' test_http_response_body -H "Authorization: Bearer bob:in_bob" http://localhost:8770/accounts/bob/balance
test_equals_or_exit '{"asset_code":"ETH","balance":-5e-16}' test_http_response_body -H "Authorization: Bearer in_alice" http://localhost:7770/accounts/alice/balance
test_equals_or_exit '{"asset_code":"ETH","balance":0.0}' test_http_response_body -H "Authorization: Bearer bob_password" http://localhost:7770/accounts/bob/balance
test_equals_or_exit '{"asset_code":"ETH","balance":0.0}' test_http_response_body -H "Authorization: Bearer alice_password" http://localhost:8770/accounts/alice/balance
test_equals_or_exit '{"asset_code":"ETH","balance":5e-16}' test_http_response_body -H "Authorization: Bearer in_bob" http://localhost:8770/accounts/bob/balance
fi
}
-->
@@ -424,7 +424,6 @@ ilp-cli accounts create alice \
--asset-scale 18 \
--max-packet-amount 100 \
--ilp-over-http-incoming-token in_alice \
--ilp-over-http-url http://localhost:7770/ilp \
--settle-to 0 &> logs/account-alice-alice.log
printf "Adding Bob's Account...\n"
@@ -435,7 +434,6 @@ ilp-cli --node http://localhost:8770 accounts create bob \
--asset-scale 18 \
--max-packet-amount 100 \
--ilp-over-http-incoming-token in_bob \
--ilp-over-http-url http://localhost:8770/ilp \
--settle-to 0 &> logs/account-bob-bob.log
printf "Adding Bob's account on Alice's node...\n"
@@ -446,8 +444,8 @@ ilp-cli accounts create bob \
--max-packet-amount 100 \
--settlement-engine-url http://localhost:3000 \
--ilp-over-http-incoming-token bob_password \
--ilp-over-http-outgoing-token alice:alice_password \
--ilp-over-http-url http://localhost:8770/ilp \
--ilp-over-http-outgoing-token alice_password \
--ilp-over-http-url http://localhost:8770/accounts/alice/ilp \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
@@ -462,8 +460,8 @@ ilp-cli --node http://localhost:8770 accounts create alice \
--max-packet-amount 100 \
--settlement-engine-url http://localhost:3001 \
--ilp-over-http-incoming-token alice_password \
--ilp-over-http-outgoing-token bob:bob_password \
--ilp-over-http-url http://localhost:7770/ilp \
--ilp-over-http-outgoing-token bob_password \
--ilp-over-http-url http://localhost:7770/accounts/bob/ilp \
--settle-threshold 500 \
--settle-to 0 \
--routing-relation Peer &> logs/account-bob-alice.log &
@@ -489,10 +487,10 @@ printf "Bob's balance on Alice's node: "
ilp-cli accounts balance bob
printf "Alice's balance on Bob's node: "
ilp-cli --node http://localhost:8770 accounts balance alice --auth alice:alice_password
ilp-cli --node http://localhost:8770 accounts balance alice --auth alice_password
printf "Bob's balance on Bob's node: "
ilp-cli --node http://localhost:8770 accounts balance bob --auth bob:in_bob
ilp-cli --node http://localhost:8770 accounts balance bob --auth in_bob
printf "\n"
-->
@@ -510,7 +508,7 @@ ilp-cli pay alice --auth in_alice \
<!--!
# wait untill the settlement is done
printf "\nWaiting for Ethereum block to be mined"
wait_to_get_http_response_body '{"asset_code":"ETH","balance":0.0}' 10 -H "Authorization: Bearer alice:alice_password" "http://localhost:8770/accounts/alice/balance" || error_and_exit "Could not confirm settlement."
wait_to_get_http_response_body '{"asset_code":"ETH","balance":0.0}' 10 -H "Authorization: Bearer alice_password" "http://localhost:8770/accounts/alice/balance" || error_and_exit "Could not confirm settlement."
printf "done\n"
-->

@@ -527,10 +525,10 @@ printf "Bob's balance on Alice's node: "
ilp-cli accounts balance bob
printf "Alice's balance on Bob's node: "
ilp-cli --node http://localhost:8770 accounts balance alice --auth alice:alice_password
ilp-cli --node http://localhost:8770 accounts balance alice --auth alice_password
printf "Bob's balance on Bob's node: "
ilp-cli --node http://localhost:8770 accounts balance bob --auth bob:in_bob
ilp-cli --node http://localhost:8770 accounts balance bob --auth in_bob
```

### 9. Kill All the Services
@@ -494,7 +494,6 @@ ilp-cli accounts create alice \
--asset-scale 6 \
--max-packet-amount 100 \
--ilp-over-http-incoming-token alice_password \
--ilp-over-http-url http://localhost:7770/ilp \
--settle-to 0 &> logs/account-alice-alice.log
printf "Adding Bob's account on Alice's node (ETH Peer relation)...\n"
@@ -505,8 +504,8 @@ ilp-cli accounts create bob \
--max-packet-amount 100 \
--settlement-engine-url http://localhost:3000 \
--ilp-over-http-incoming-token bob_password \
--ilp-over-http-outgoing-token alice:alice_password \
--ilp-over-http-url http://localhost:8770/ilp \
--ilp-over-http-outgoing-token alice_password \
--ilp-over-http-url http://localhost:8770/accounts/alice/ilp \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
@@ -521,8 +520,8 @@ ilp-cli --node http://localhost:8770 accounts create alice \
--max-packet-amount 100 \
--settlement-engine-url http://localhost:3001 \
--ilp-over-http-incoming-token alice_password \
--ilp-over-http-outgoing-token bob:bob_password \
--ilp-over-http-url http://localhost:7770/ilp \
--ilp-over-http-outgoing-token bob_password \
--ilp-over-http-url http://localhost:7770/accounts/bob/ilp \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
@@ -538,8 +537,8 @@ ilp-cli --node http://localhost:8770 accounts create charlie \
--max-packet-amount 100 \
--settlement-engine-url http://localhost:3002 \
--ilp-over-http-incoming-token charlie_password \
--ilp-over-http-outgoing-token bob:bob_other_password \
--ilp-over-http-url http://localhost:9770/ilp \
--ilp-over-http-outgoing-token bob_other_password \
--ilp-over-http-url http://localhost:9770/accounts/bob/ilp \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
@@ -553,7 +552,6 @@ ilp-cli --node http://localhost:9770 accounts create charlie \
--asset-scale 6 \
--max-packet-amount 100 \
--ilp-over-http-incoming-token charlie_password \
--ilp-over-http-url http://localhost:9770/ilp \
--settle-to 0 &> logs/account-charlie-charlie.log
printf "Adding Bob's account on Charlie's node (XRP Parent relation)...\n"
@@ -572,8 +570,8 @@ ilp-cli --node http://localhost:9770 accounts create bob \
--max-packet-amount 100 \
--settlement-engine-url http://localhost:3003 \
--ilp-over-http-incoming-token bob_other_password \
--ilp-over-http-outgoing-token charlie:charlie_password \
--ilp-over-http-url http://localhost:8770/ilp \
--ilp-over-http-outgoing-token charlie_password \
--ilp-over-http-url http://localhost:8770/accounts/charlie/ilp \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
@@ -273,8 +273,8 @@ ilp-cli accounts create node_b \
--asset-code ABC \
--asset-scale 9 \
--ilp-address example.node_b \
--ilp-over-http-outgoing-token node_a:node_a-password \
--ilp-over-http-url 'http://localhost:8770/ilp' \
--ilp-over-http-outgoing-token node_a-password \
--ilp-over-http-url 'http://localhost:8770/accounts/node_a/ilp' \
&>logs/account-node_a-node_b.log
# Insert accounts on Node B
@@ -2,10 +2,10 @@
# For integration tests
function post_test_hook() {
if [ $TEST_MODE -eq 1 ]; then
test_equals_or_exit '{"asset_code":"XRP","balance":-0.0005}' test_http_response_body -H "Authorization: Bearer alice:in_alice" http://localhost:7770/accounts/alice/balance
test_equals_or_exit '{"asset_code":"XRP","balance":0.0}' test_http_response_body -H "Authorization: Bearer bob:bob_password" http://localhost:7770/accounts/bob/balance
test_equals_or_exit '{"asset_code":"XRP","balance":0.0}' test_http_response_body -H "Authorization: Bearer alice:alice_password" http://localhost:8770/accounts/alice/balance
test_equals_or_exit '{"asset_code":"XRP","balance":0.0005}' test_http_response_body -H "Authorization: Bearer bob:in_bob" http://localhost:8770/accounts/bob/balance
test_equals_or_exit '{"asset_code":"XRP","balance":-0.0005}' test_http_response_body -H "Authorization: Bearer in_alice" http://localhost:7770/accounts/alice/balance
test_equals_or_exit '{"asset_code":"XRP","balance":0.0}' test_http_response_body -H "Authorization: Bearer bob_password" http://localhost:7770/accounts/bob/balance
test_equals_or_exit '{"asset_code":"XRP","balance":0.0}' test_http_response_body -H "Authorization: Bearer alice_password" http://localhost:8770/accounts/alice/balance
test_equals_or_exit '{"asset_code":"XRP","balance":0.0005}' test_http_response_body -H "Authorization: Bearer in_bob" http://localhost:8770/accounts/bob/balance
fi
}
-->
@@ -316,7 +316,6 @@ ilp-cli accounts create alice \
--asset-scale 6 \
--max-packet-amount 100 \
--ilp-over-http-incoming-token in_alice \
--ilp-over-http-url http://localhost:7770/ilp \
--settle-to 0 &> logs/account-alice-alice.log
printf "Adding Bob's Account...\n"
@@ -327,7 +326,6 @@ ilp-cli --node http://localhost:8770 accounts create bob \
--asset-scale 6 \
--max-packet-amount 100 \
--ilp-over-http-incoming-token in_bob \
--ilp-over-http-url http://localhost:8770/ilp \
--settle-to 0 &> logs/account-bob-bob.log
printf "Adding Bob's account on Alice's node...\n"
@@ -338,8 +336,8 @@ ilp-cli accounts create bob \
--max-packet-amount 100 \
--settlement-engine-url http://localhost:3000 \
--ilp-over-http-incoming-token bob_password \
--ilp-over-http-outgoing-token alice:alice_password \
--ilp-over-http-url http://localhost:8770/ilp \
--ilp-over-http-outgoing-token alice_password \
--ilp-over-http-url http://localhost:8770/accounts/alice/ilp \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
@@ -354,8 +352,8 @@ ilp-cli --node http://localhost:8770 accounts create alice \
--max-packet-amount 100 \
--settlement-engine-url http://localhost:3001 \
--ilp-over-http-incoming-token alice_password \
--ilp-over-http-outgoing-token bob:bob_password \
--ilp-over-http-url http://localhost:7770/ilp \
--ilp-over-http-outgoing-token bob_password \
--ilp-over-http-url http://localhost:7770/accounts/bob/ilp \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
@@ -408,7 +406,7 @@ printf "\n"
# wait untill the settlement is done
printf "\nWaiting for XRP ledger to be validated"
wait_to_get_http_response_body '{"asset_code":"XRP","balance":0.0}' 20 -H "Authorization: Bearer alice:alice_password" "http://localhost:8770/accounts/alice/balance" || error_and_exit "Could not confirm settlement."
wait_to_get_http_response_body '{"asset_code":"XRP","balance":0.0}' 20 -H "Authorization: Bearer alice_password" "http://localhost:8770/accounts/alice/balance" || error_and_exit "Could not confirm settlement."
printf "done\n"
-->

0 comments on commit ee35475

Please sign in to comment.
You can’t perform that action at this time.