Skip to content

Commit

Permalink
nixos/tests: test kairos-cli in end-to-end test
Browse files Browse the repository at this point in the history
  • Loading branch information
marijanp committed Mar 18, 2024
1 parent f56552d commit 8c24344
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ in
./tests/end-to-end.nix
{
inherit mkKairosHostConfig;
inherit (self.packages."x86_64-linux") kairos;
};
};
nixosModules = {
Expand Down
14 changes: 13 additions & 1 deletion nixos/tests/end-to-end.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ nixosTest
, mkKairosHostConfig
, kairos
, testResources ? ../../kairos-cli/tests/fixtures
}:
nixosTest {
name = "kairos e2e test";
Expand All @@ -18,7 +20,7 @@ nixosTest {
};

client = { config, pkgs, nodes, ... }: {
environment.systemPackages = [ pkgs.curl ];
environment.systemPackages = [ pkgs.curl kairos ];
};
};

Expand All @@ -41,5 +43,15 @@ 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_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")
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
'';
}

0 comments on commit 8c24344

Please sign in to comment.