Skip to content

Commit

Permalink
nixos/tests: test both ed25519 and secp256k1 in e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
marijanp committed Mar 19, 2024
1 parent 54a8b9a commit cb3abd0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion nixos/tests/end-to-end.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ nixosTest {
client.wait_for_unit ("multi-user.target")
deposit_request = { "public_key": "publickey", "amount": 10 }
# REST API
client.succeed("curl -X POST http://kairos/api/v1/deposit -H 'Content-Type: application/json' -d '{}'".format(json.dumps(deposit_request)))
transfer_request = { "from": "publickey", "signature": "signature", "to": "publickey", "amount": 10 }
Expand All @@ -44,14 +45,25 @@ nixosTest {
withdraw_request = { "public_key": "publickey", "signature": "signature", "amount": 10 }
client.succeed("curl -X POST http://kairos/api/v1/withdraw -H 'Content-Type: application/json' -d '{}'".format(json.dumps(withdraw_request)))
# CLI with ed25519
cli_output = client.succeed("kairos-cli deposit --amount 1000 --private-key ${testResources}/ed25519/secret_key.pem")
assert "ok\n" in cli_output
cli_output = client.succeed("kairos-cli transfer --recipient '01a26419a7d82b2263deaedea32d35eee8ae1c850bd477f62a82939f06e80df356' --amount 1000 --private-key ${testResources}/secp256k1/secret_key.pem")
cli_output = client.succeed("kairos-cli transfer --recipient '01a26419a7d82b2263deaedea32d35eee8ae1c850bd477f62a82939f06e80df356' --amount 1000 --private-key ${testResources}/ed25519/secret_key.pem")
assert "ok\n" in cli_output
cli_output = client.succeed("kairos-cli withdraw --amount 1000 --private-key ${testResources}/ed25519/secret_key.pem")
assert "ok\n" in cli_output
# CLI with secp256k1
cli_output = client.succeed("kairos-cli deposit --amount 1000 --private-key ${testResources}/secp256k1/secret_key.pem")
assert "ok\n" in cli_output
cli_output = client.succeed("kairos-cli transfer --recipient '01a26419a7d82b2263deaedea32d35eee8ae1c850bd477f62a82939f06e80df356' --amount 1000 --private-key ${testResources}/secp256k1/secret_key.pem")
assert "ok\n" in cli_output
cli_output = client.succeed("kairos-cli withdraw --amount 1000 --private-key ${testResources}/secp256k1/secret_key.pem")
assert "ok\n" in cli_output
'';
}

0 comments on commit cb3abd0

Please sign in to comment.