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

Additional checks for listing stake keys in e2e tests #2691

Merged
merged 2 commits into from
Jun 8, 2021
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/e2e-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/e2e/Gemfile
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
30 changes: 30 additions & 0 deletions test/e2e/spec/e2e_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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)
Expand All @@ -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

Expand Down
13 changes: 13 additions & 0 deletions test/e2e/spec/shelley_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down