From e4b1e8814eb2f1ba62093e98fac68e2322c74f5d Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Mon, 7 Jun 2021 13:22:56 +0200 Subject: [PATCH 1/2] Additional checks for listing stake keys in e2e tests --- test/e2e/Gemfile | 2 +- test/e2e/Gemfile.lock | 4 ++-- test/e2e/spec/e2e_spec.rb | 30 ++++++++++++++++++++++++++++++ test/e2e/spec/shelley_spec.rb | 13 +++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/test/e2e/Gemfile b/test/e2e/Gemfile index d66bd8c28a2..1d2648b073f 100644 --- a/test/e2e/Gemfile +++ b/test/e2e/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'cardano_wallet', '~> 0.3.9' +gem 'cardano_wallet', '~> 0.3.10' # gem 'cardano_wallet', path: "~/wb/cardano_wallet" gem 'bip_mnemonic', '0.0.4' gem 'rake', '12.3.3' diff --git a/test/e2e/Gemfile.lock b/test/e2e/Gemfile.lock index c5f06cdd864..86382ea1f5d 100644 --- a/test/e2e/Gemfile.lock +++ b/test/e2e/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: bip_mnemonic (0.0.4) - cardano_wallet (0.3.9) + cardano_wallet (0.3.10) httparty (~> 0.18.0) diff-lcs (1.4.4) httparty (0.18.1) @@ -32,7 +32,7 @@ PLATFORMS DEPENDENCIES bip_mnemonic (= 0.0.4) - cardano_wallet (~> 0.3.9) + cardano_wallet (~> 0.3.10) rake (= 12.3.3) rspec (= 3.10.0) diff --git a/test/e2e/spec/e2e_spec.rb b/test/e2e/spec/e2e_spec.rb index 29161563c74..f7e36bf94e4 100644 --- a/test/e2e/spec/e2e_spec.rb +++ b/test/e2e/spec/e2e_spec.rb @@ -388,6 +388,16 @@ (available == amt) && (total == amt) end + # Check wallet stake keys before joing stake pool + stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id_pools) + expect(stake_keys).to be_correct_and_respond 200 + expect(stake_keys['foreign'].size).to eq 0 + expect(stake_keys['ours'].size).to eq 1 + expect(stake_keys['ours'].first['stake']['quantity']).to eq amt + expect(stake_keys['none']['stake']['quantity']).to eq 0 + expect(stake_keys['ours'].first['delegation']['active']['status']).to eq "not_delegating" + expect(stake_keys['ours'].first['delegation']['next']).to eq [] + # Pick up pool id to join pools = SHELLEY.stake_pools pool_id = pools.list({ stake: 1000 }).sample['id'] @@ -405,6 +415,16 @@ tx['status'] == "in_ledger" end + # Check wallet stake keys after joing stake pool + stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id_pools) + expect(stake_keys).to be_correct_and_respond 200 + expect(stake_keys['foreign'].size).to eq 0 + expect(stake_keys['ours'].size).to eq 1 + expect(stake_keys['ours'].first['stake']['quantity']).to be > 0 + expect(stake_keys['none']['stake']['quantity']).to eq 0 + expect(stake_keys['ours'].first['delegation']['active']['status']).to eq "not_delegating" + expect(stake_keys['ours'].first['delegation']['next'].first['status']).to eq "delegating" + # Quit pool puts "Quitting pool: #{pool_id}" quit = pools.quit(@target_id_pools, PASS) @@ -417,6 +437,16 @@ tx = SHELLEY.transactions.get(@target_id_pools, quit_tx_id) tx['status'] == "in_ledger" end + + # Check wallet stake keys after quitting stake pool + stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id_pools) + expect(stake_keys).to be_correct_and_respond 200 + expect(stake_keys['foreign'].size).to eq 0 + expect(stake_keys['ours'].size).to eq 1 + expect(stake_keys['ours'].first['stake']['quantity']).to be > 0 + expect(stake_keys['none']['stake']['quantity']).to eq 0 + expect(stake_keys['ours'].first['delegation']['active']['status']).to eq "not_delegating" + expect(stake_keys['ours'].first['delegation']['next'].first['status']).to eq "not_delegating" end end diff --git a/test/e2e/spec/shelley_spec.rb b/test/e2e/spec/shelley_spec.rb index 0835ce82e5e..f2649c6d572 100644 --- a/test/e2e/spec/shelley_spec.rb +++ b/test/e2e/spec/shelley_spec.rb @@ -263,6 +263,19 @@ teardown end + it "I can list stake keys" do + id = create_shelley_wallet + stake_keys = SHELLEY.stake_pools.list_stake_keys(id) + expect(stake_keys).to be_correct_and_respond 200 + expect(stake_keys['foreign'].size).to eq 0 + expect(stake_keys['ours'].size).to eq 1 + expect(stake_keys['ours'].first['stake']).to eq({ "quantity" => 0, "unit" => "lovelace" }) + expect(stake_keys['none']['stake']).to eq({ "quantity" => 0, "unit" => "lovelace" }) + expect(stake_keys['ours'].first['delegation']).to eq({ "next" => [], + "active" => + { "status" => "not_delegating" } }) + end + it "ADP-634 - Pool metadata is updated when settings are updated" do settings = CardanoWallet.new.misc.settings pools = SHELLEY.stake_pools From ced607f7eb293e126f1bc2301c060303ce171623 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Tue, 8 Jun 2021 16:42:55 +0200 Subject: [PATCH 2/2] Bump node to 1.27.0 in docker e2e tests --- .github/workflows/e2e-docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-docker.yml b/.github/workflows/e2e-docker.yml index 32ee1822763..006ddc03c29 100644 --- a/.github/workflows/e2e-docker.yml +++ b/.github/workflows/e2e-docker.yml @@ -8,7 +8,7 @@ on: nodeTag: description: 'Node tag (docker)' required: true - default: '1.26.2' + default: '1.27.0' walletTag: description: 'Wallet tag (docker)' required: true @@ -96,4 +96,4 @@ jobs: TESTS_E2E_FIXTURES: ${{ secrets.TESTS_E2E_FIXTURES }} NETWORK: testnet WALLET: dev-master - NODE: 1.26.2 + NODE: 1.27.0