From 67424440722dafb9a14c5c3451cd1c85b643240b Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 31 Mar 2022 23:24:05 +0200 Subject: [PATCH 1/9] Encode/decode blockfrost API key --- test/e2e/.gitignore | 1 + test/e2e/.rake_tasks~ | 4 +-- test/e2e/Rakefile | 33 ++++++++++++++++-------- test/e2e/env.rb | 3 ++- test/e2e/fixtures/blockfrost.api.key.gpg | 1 + 5 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 test/e2e/fixtures/blockfrost.api.key.gpg diff --git a/test/e2e/.gitignore b/test/e2e/.gitignore index 3245f5ef2a1..a0aaf2fd0c6 100644 --- a/test/e2e/.gitignore +++ b/test/e2e/.gitignore @@ -4,6 +4,7 @@ # secrets /fixtures/fixture_wallets.json +/fixtures/blockfrost.api.key # local environment variables /.envrc-local diff --git a/test/e2e/.rake_tasks~ b/test/e2e/.rake_tasks~ index e2ecfc2f4e6..b0b54c0da8c 100644 --- a/test/e2e/.rake_tasks~ +++ b/test/e2e/.rake_tasks~ @@ -2,8 +2,8 @@ clean_bins clean_logs datetime display_versions -fixture_wallets_decode -fixture_wallets_encode +secrets_decode +secrets_encode fixture_wallets_template get_docker_logs get_latest_bins diff --git a/test/e2e/Rakefile b/test/e2e/Rakefile index a17a0da1880..dcb85551935 100644 --- a/test/e2e/Rakefile +++ b/test/e2e/Rakefile @@ -16,6 +16,7 @@ WALLET_DB = absolute_path ENV['TESTS_WALLET_DB'] BINS = absolute_path ENV['TESTS_E2E_BINDIR'] FIXTURES_FILE = absolute_path ENV['TESTS_E2E_FIXTURES_FILE'] +BLOCKFROST_FILE = absolute_path ENV['TESTS_E2E_BLOCKFROST_FILE'] FIXTURES_SECRET = absolute_path ENV['TESTS_E2E_FIXTURES'] TOKEN_METADATA = ENV['TESTS_E2E_TOKEN_METADATA'] @@ -26,22 +27,32 @@ ENV['PATH'] = "#{BINS}#{path_separator}#{ENV['PATH']}" task :default => :spec -task :fixture_wallets_encode do - desc "Encode fixture wallets from #{FIXTURES_FILE} using $TESTS_E2E_FIXTURES phrase" - puts "\n >> Encoding #{FIXTURES_FILE}..." +task :secrets_encode do + desc "Encode secrets using $TESTS_E2E_FIXTURES phrase" + puts "\n >> Encoding #{FIXTURES_FILE}..." puts `gpg --pinentry-mode loopback --passphrase=#{FIXTURES_SECRET} --symmetric --output=#{FIXTURES_FILE}.gpg #{FIXTURES_FILE}` + + puts "\n >> Encoding #{BLOCKFROST_FILE}..." + puts `gpg --pinentry-mode loopback --passphrase=#{BLOCKFROST_FILE} --symmetric --output=#{BLOCKFROST_FILE}.gpg #{BLOCKFROST_FILE}` + end -task :fixture_wallets_decode do - desc "Decode fixture wallets from #{FIXTURES_FILE}.gpg using $TESTS_E2E_FIXTURES phrase" - encoded_file = "#{FIXTURES_FILE}.gpg" - decoded_file = FIXTURES_FILE - if File.exists?(decoded_file) - puts "\n >> Skipping decoding #{encoded_file}... #{decoded_file} already exists!" +task :secrets_decode do + desc "Decode secrets using $TESTS_E2E_FIXTURES phrase" + + if File.exists?(FIXTURES_FILE) + puts "\n >> Skipping decoding #{FIXTURES_FILE}.gpg... #{FIXTURES_FILE} already exists!" else puts "\n >> Decoding #{FIXTURES_FILE}.gpg..." - puts `gpg --pinentry-mode loopback --yes --passphrase=#{FIXTURES_SECRET} --output #{decoded_file} --decrypt #{encoded_file}` + puts `gpg --pinentry-mode loopback --yes --passphrase=#{FIXTURES_SECRET} --output #{FIXTURES_FILE} --decrypt #{FIXTURES_FILE}.gpg` + end + + if File.exists?(BLOCKFROST_FILE) + puts "\n >> Skipping decoding #{BLOCKFROST_FILE}.gpg... #{BLOCKFROST_FILE} already exists!" + else + puts "\n >> Decoding #{BLOCKFROST_FILE}.gpg..." + puts `gpg --pinentry-mode loopback --yes --passphrase=#{FIXTURES_SECRET} --output #{BLOCKFROST_FILE} --decrypt #{BLOCKFROST_FILE}.gpg` end end @@ -296,7 +307,7 @@ task :setup, [:env, :pr, :skip_configs] do |task, args| Rake::Task[:get_latest_bins].invoke(pr) end Rake::Task[:get_latest_configs].invoke(env) unless skip_configs - Rake::Task[:fixture_wallets_decode].invoke + Rake::Task[:secrets_decode].invoke end task :run_on, [:env, :sync_strategy, :skip_configs, :pr] do |task, args| diff --git a/test/e2e/env.rb b/test/e2e/env.rb index 4b5ce4d0c21..d17155ff0ee 100644 --- a/test/e2e/env.rb +++ b/test/e2e/env.rb @@ -1,7 +1,8 @@ ## -# fixture wallets with mnemonics +# secrets 🤫 ENV['TESTS_E2E_FIXTURES'] ||= "this_is_wrong_secret" ENV['TESTS_E2E_FIXTURES_FILE'] ||= "./fixtures/fixture_wallets.json" +ENV['TESTS_E2E_BLOCKFROST_FILE'] ||= "./fixtures/blockfrost.api.key" ## # Wallet/node databases, logs and configs will be stored here diff --git a/test/e2e/fixtures/blockfrost.api.key.gpg b/test/e2e/fixtures/blockfrost.api.key.gpg new file mode 100644 index 00000000000..2f5622b5b5e --- /dev/null +++ b/test/e2e/fixtures/blockfrost.api.key.gpg @@ -0,0 +1 @@ +Œ ù…Çé”ÿÒoéRÖìÌIP6âpçEOÛŸ²#¿ø|Vnµ¬_ô§Ñ’³¿KŒGPÓÐ/í|Ðõ«DjB[LܸzOV§ž¨ìåþÜ#ôô‰¥XÔ…µá¡yÔ駗âî?‚ºLVÓêD"Ýe´Ÿ \ No newline at end of file From 4275dad28c6f34f426af766386f49b814acda441 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 31 Mar 2022 23:53:33 +0200 Subject: [PATCH 2/9] Start/stop light wallet --- test/e2e/.rake_tasks~ | 2 ++ test/e2e/Rakefile | 73 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 62 insertions(+), 13 deletions(-) diff --git a/test/e2e/.rake_tasks~ b/test/e2e/.rake_tasks~ index b0b54c0da8c..2fa7c8eba54 100644 --- a/test/e2e/.rake_tasks~ +++ b/test/e2e/.rake_tasks~ @@ -13,4 +13,6 @@ spec setup start_node_and_wallet stop_node_and_wallet +start_wallet_lite +stop_wallet_lite wait_until_node_synced diff --git a/test/e2e/Rakefile b/test/e2e/Rakefile index dcb85551935..ef74e918fea 100644 --- a/test/e2e/Rakefile +++ b/test/e2e/Rakefile @@ -192,19 +192,6 @@ task :start_node_and_wallet, [:env] do |task, args| end end -task :display_versions do - puts "\n >> cardano-node and cardano-wallet versions:" - - bin_dir = BINS == '' ? BINS : "#{BINS}/" - if is_win? - cmd "#{bin_dir}cardano-wallet.exe version", true - cmd "#{bin_dir}cardano-node.exe version", true - else - cmd "#{bin_dir}cardano-wallet version", true - cmd "#{bin_dir}cardano-node version", true - end -end - task :stop_node_and_wallet, [:env] do |task, args| puts "\n >> Stopping cardano-node and cardano-wallet" @@ -221,6 +208,66 @@ task :stop_node_and_wallet, [:env] do |task, args| end +task :start_wallet_lite, [:env] do |task, args| + puts "\n >> Setting up cardano-wallet-lite" + + bin_dir = BINS == '' ? BINS : "#{BINS}/" + config_dir = File.join(CONFIGS, args[:env]) + log_dir = File.join(LOGS, args[:env]) + wallet_db_dir = File.join(WALLET_DB, args[:env]) + cd = Dir.pwd + mk_dir(STATE) + mk_dir(log_dir) + + if is_win? + # create cardano-wallet.bat file + wallet_cmd = "#{bin_dir}cardano-wallet.exe serve --port #{WALLET_PORT} --light --blockfrost-token-file #{BLOCKFROST_FILE} --testnet #{config_dir}/genesis-byron.json --database #{wallet_db_dir} --token-metadata-server #{TOKEN_METADATA}" + File.open("cardano-wallet.bat", "w") do |f| + f.write(wallet_cmd) + end + + install_wallet = "nssm install cardano-wallet-lite #{cd}/cardano-wallet.bat" + log_stdout_wallet = "nssm set cardano-wallet-lite AppStdout #{log_dir}/wallet.log" + log_stderr_wallet = "nssm set cardano-wallet-lite AppStderr #{log_dir}/wallet.log" + start_wallet = "nssm start cardano-wallet-lite" + + cmd install_wallet + cmd log_stdout_wallet + cmd log_stderr_wallet + cmd start_wallet + else + start_wallet = "#{bin_dir}cardano-wallet serve --port #{WALLET_PORT} --light --blockfrost-token-file #{BLOCKFROST_FILE} --testnet #{config_dir}/genesis-byron.json --database #{wallet_db_dir} --token-metadata-server #{TOKEN_METADATA}" + + cmd "screen -dmS WALLET_#{args[:env]}_lite -L -Logfile #{log_dir}/wallet.log #{start_wallet}" + cmd "screen -ls", true + end +end + +task :stop_wallet_lite, [:env] do |task, args| + puts "\n >> Stopping cardano-wallet-lite" + + if is_win? + cmd "nssm stop cardano-wallet-lite" + cmd "nssm remove cardano-wallet-lite confirm" + else + cmd "screen -XS WALLET_#{args[:env]}_lite quit" + end + +end + +task :display_versions do + puts "\n >> cardano-node and cardano-wallet versions:" + + bin_dir = BINS == '' ? BINS : "#{BINS}/" + if is_win? + cmd "#{bin_dir}cardano-wallet.exe version", true + cmd "#{bin_dir}cardano-node.exe version", true + else + cmd "#{bin_dir}cardano-wallet version", true + cmd "#{bin_dir}cardano-node version", true + end +end + task :get_latest_bins, [:pr] do |task, args| puts "\n >> Getting latest node and wallet binaries from Hydra into #{BINS}" From eef6c71ddaf1ac2ac84665e7328353e003732976 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 1 Apr 2022 10:09:26 +0200 Subject: [PATCH 3/9] Add workflows for light mode --- .github/workflows/e2e-linux-lite.yml | 67 +++++++++++++++++++++++ .github/workflows/e2e-macos-lite.yml | 70 ++++++++++++++++++++++++ .github/workflows/e2e-windows-lite.yml | 73 ++++++++++++++++++++++++++ 3 files changed, 210 insertions(+) create mode 100644 .github/workflows/e2e-linux-lite.yml create mode 100644 .github/workflows/e2e-macos-lite.yml create mode 100644 .github/workflows/e2e-windows-lite.yml diff --git a/.github/workflows/e2e-linux-lite.yml b/.github/workflows/e2e-linux-lite.yml new file mode 100644 index 00000000000..7e65a36e4a5 --- /dev/null +++ b/.github/workflows/e2e-linux-lite.yml @@ -0,0 +1,67 @@ +name: E2E Linux Light + +on: + schedule: + - cron: "0 22 * * *" + workflow_dispatch: + inputs: + network: + description: 'Network' + required: true + default: 'testnet' + pr: + description: 'PR number or "master"' + default: 'master' + +defaults: + run: + working-directory: ./test/e2e + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.1 + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: 🕒 Get Date/Time + id: date-time + shell: bash + run: | + echo "::set-output name=value::$(rake datetime)" + + - name: âš™ï¸ Setup (get latest bins and configs and decode fixtures) + run: rake setup[$NETWORK,$PR] + + - name: 🔠Display versions + run: rake display_versions + + - name: 🚀 Start wallet light mode + run: rake start_wallet_lite[$NETWORK] + + - name: 🧪 Run all light-mode tests + run: rake spec SPEC_OPTS="-t lite" + + - name: ðŸ Stop wallet light mode + run: rake stop_wallet_lite[$NETWORK] + + - name: 📎 Upload logs + uses: actions/upload-artifact@v2 + if: always() + with: + name: ${{ runner.os }}-logs + path: test/e2e/state/logs + + env: + TESTS_E2E_FIXTURES: ${{ secrets.TESTS_E2E_FIXTURES }} + NETWORK: ${{ github.event.inputs.network || 'testnet' }} + PR: ${{ github.event.inputs.pr || '' }} diff --git a/.github/workflows/e2e-macos-lite.yml b/.github/workflows/e2e-macos-lite.yml new file mode 100644 index 00000000000..3c283d75944 --- /dev/null +++ b/.github/workflows/e2e-macos-lite.yml @@ -0,0 +1,70 @@ +name: E2E MacOS light + +on: + schedule: + - cron: "0 22 * * *" + workflow_dispatch: + inputs: + network: + description: 'Network' + required: true + default: 'testnet' + pr: + description: 'PR number or "master"' + default: 'master' + +defaults: + run: + working-directory: ./test/e2e + +jobs: + test: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.1 + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Prepare MacOS + run: brew install screen + + - name: 🕒 Get Date/Time + id: date-time + shell: bash + run: | + echo "::set-output name=value::$(rake datetime)" + + - name: âš™ï¸ Setup (get latest bins and configs and decode fixtures) + run: rake setup[$NETWORK,$PR] + + - name: 🔠Display versions + run: rake display_versions + + - name: 🚀 Start node and wallet + run: rake start_wallet_lite[$NETWORK] + + - name: 🧪 Run all tests + run: rake spec SPEC_OPTS="-t lite" + + - name: ðŸ Stop node and wallet + run: rake stop_wallet_lite[$NETWORK] + + - name: 📎 Upload logs + uses: actions/upload-artifact@v2 + if: always() + with: + name: ${{ runner.os }}-logs + path: test/e2e/state/logs + + env: + TESTS_E2E_FIXTURES: ${{ secrets.TESTS_E2E_FIXTURES }} + NETWORK: ${{ github.event.inputs.network || 'testnet' }} + PR: ${{ github.event.inputs.pr || '' }} diff --git a/.github/workflows/e2e-windows-lite.yml b/.github/workflows/e2e-windows-lite.yml new file mode 100644 index 00000000000..2d4f9005f3a --- /dev/null +++ b/.github/workflows/e2e-windows-lite.yml @@ -0,0 +1,73 @@ +name: E2E Windows Light + +on: + schedule: + - cron: "0 22 * * *" + workflow_dispatch: + inputs: + network: + description: 'Network' + required: true + default: 'testnet' + pr: + description: 'PR number or "master"' + default: 'master' + +defaults: + run: + working-directory: ./test/e2e + +jobs: + test: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.1 + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Prepare Windows + run: | + choco install wget + choco install unzip + choco install nssm + + - name: 🕒 Get Date/Time + id: date-time + shell: bash + run: | + echo "::set-output name=value::$(rake datetime)" + + - name: âš™ï¸ Setup (get latest bins and configs and decode fixtures) + run: rake setup[%NETWORK%,%PR%] + + - name: 🔠Display versions + run: rake display_versions + + - name: 🚀 Start node and wallet + run: rake start_wallet_lite[%NETWORK%] + + - name: 🧪 Run all tests + run: rake spec + + - name: ðŸ Stop node and wallet + run: rake stop_wallet_lite[%NETWORK%] + + - name: 📎 Upload logs + uses: actions/upload-artifact@v2 + if: always() + with: + name: ${{ runner.os }}-logs + path: test/e2e/state/logs + + env: + NETWORK: ${{ github.event.inputs.network || 'testnet' }} + TESTS_E2E_FIXTURES: ${{ secrets.TESTS_E2E_FIXTURES }} + PR: ${{ github.event.inputs.pr || 'master' }} From adc88bd837fd9246a1cd078b34a28dc2c41234f0 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 1 Apr 2022 10:09:55 +0200 Subject: [PATCH 4/9] Tag tests lite for light mode --- test/e2e/spec/e2e_spec.rb | 2 +- test/e2e/spec/misc_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e/spec/e2e_spec.rb b/test/e2e/spec/e2e_spec.rb index e4b64f73d50..15ef0178201 100644 --- a/test/e2e/spec/e2e_spec.rb +++ b/test/e2e/spec/e2e_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe "Cardano Wallet E2E tests", :e2e => true do +RSpec.describe "Cardano Wallet E2E tests", :e2e do before(:all) do # shelley wallets diff --git a/test/e2e/spec/misc_spec.rb b/test/e2e/spec/misc_spec.rb index d95d623f3da..776db4095e8 100644 --- a/test/e2e/spec/misc_spec.rb +++ b/test/e2e/spec/misc_spec.rb @@ -7,7 +7,7 @@ expect(res).to be_correct_and_respond 200 end - it "Can check network clock offset" do + it "Can check network clock offset", :lite do res = NETWORK.clock expect(res).to be_correct_and_respond 200 end @@ -34,7 +34,7 @@ end end - describe CardanoWallet::Misc::Utils do + describe CardanoWallet::Misc::Utils, :lite do describe "SMASH health" do it "SMASH health - unreachable" do @@ -266,7 +266,7 @@ end end - describe CardanoWallet::Misc::Proxy do + describe CardanoWallet::Misc::Proxy, :lite do it "Malformed payload when tx is not binary" do pending "ADP-1145 - DecoderErrorDeserialiseFailure error message from the API /proxy/transactions" no_binary_blob = "test" @@ -276,7 +276,7 @@ end end - describe CardanoWallet::Misc::Settings do + describe CardanoWallet::Misc::Settings, :lite do after(:all) do SETTINGS.update({ :pool_metadata_source => "none" }) From 72a7d86d12a109da596c50d0f9e9c60c1ea51f46 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 1 Apr 2022 12:10:47 +0200 Subject: [PATCH 5/9] Encode with correct passphrase --- test/e2e/Rakefile | 2 +- test/e2e/fixtures/blockfrost.api.key.gpg | Bin 128 -> 128 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/Rakefile b/test/e2e/Rakefile index ef74e918fea..e43b8fb4aa1 100644 --- a/test/e2e/Rakefile +++ b/test/e2e/Rakefile @@ -34,7 +34,7 @@ task :secrets_encode do puts `gpg --pinentry-mode loopback --passphrase=#{FIXTURES_SECRET} --symmetric --output=#{FIXTURES_FILE}.gpg #{FIXTURES_FILE}` puts "\n >> Encoding #{BLOCKFROST_FILE}..." - puts `gpg --pinentry-mode loopback --passphrase=#{BLOCKFROST_FILE} --symmetric --output=#{BLOCKFROST_FILE}.gpg #{BLOCKFROST_FILE}` + puts `gpg --pinentry-mode loopback --passphrase=#{FIXTURES_SECRET} --symmetric --output=#{BLOCKFROST_FILE}.gpg #{BLOCKFROST_FILE}` end diff --git a/test/e2e/fixtures/blockfrost.api.key.gpg b/test/e2e/fixtures/blockfrost.api.key.gpg index 2f5622b5b5e32681a3bcb3976c1ac753657149b8..3cddc2b3949b135c259b2b65afbe3930c3953561 100644 GIT binary patch literal 128 zcmV-`0Du3C4Fm@R05|=tEWj literal 128 zcmV-`0Du3C4Fm@R0{MlgFi0qGV}*6bI|Nl-Qx;&A6hPurieBft23R&KSd zU-S;Aj}Fn2v%gD>M^MwyFYSEL^{W#^YC>C&Ox%r+xEOj*R;Qk*?B)KQ+#~e#i4dh& i)P)!mwc(+8)aj=em*Va}g1Ssr)9OSb9gp2*w4Voz3PY0s From 678214ea064ffe2f1353f40e1e75aff2c6eb7593 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 1 Apr 2022 12:36:53 +0200 Subject: [PATCH 6/9] Workflow adjustments --- .github/workflows/e2e-linux-lite.yml | 8 ++++---- .github/workflows/e2e-macos-lite.yml | 6 +++--- .github/workflows/e2e-windows-lite.yml | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/e2e-linux-lite.yml b/.github/workflows/e2e-linux-lite.yml index 7e65a36e4a5..d1369e997fa 100644 --- a/.github/workflows/e2e-linux-lite.yml +++ b/.github/workflows/e2e-linux-lite.yml @@ -1,4 +1,4 @@ -name: E2E Linux Light +name: E2E Linux --light on: schedule: @@ -45,13 +45,13 @@ jobs: - name: 🔠Display versions run: rake display_versions - - name: 🚀 Start wallet light mode + - name: 🚀 Start wallet --light run: rake start_wallet_lite[$NETWORK] - - name: 🧪 Run all light-mode tests + - name: 🧪 Run all tests run: rake spec SPEC_OPTS="-t lite" - - name: ðŸ Stop wallet light mode + - name: ðŸ Stop wallet --light run: rake stop_wallet_lite[$NETWORK] - name: 📎 Upload logs diff --git a/.github/workflows/e2e-macos-lite.yml b/.github/workflows/e2e-macos-lite.yml index 3c283d75944..70d25d2369a 100644 --- a/.github/workflows/e2e-macos-lite.yml +++ b/.github/workflows/e2e-macos-lite.yml @@ -1,4 +1,4 @@ -name: E2E MacOS light +name: E2E MacOS --light on: schedule: @@ -48,13 +48,13 @@ jobs: - name: 🔠Display versions run: rake display_versions - - name: 🚀 Start node and wallet + - name: 🚀 Start wallet --light run: rake start_wallet_lite[$NETWORK] - name: 🧪 Run all tests run: rake spec SPEC_OPTS="-t lite" - - name: ðŸ Stop node and wallet + - name: ðŸ Stop wallet --light run: rake stop_wallet_lite[$NETWORK] - name: 📎 Upload logs diff --git a/.github/workflows/e2e-windows-lite.yml b/.github/workflows/e2e-windows-lite.yml index 2d4f9005f3a..f17b561d5c0 100644 --- a/.github/workflows/e2e-windows-lite.yml +++ b/.github/workflows/e2e-windows-lite.yml @@ -1,4 +1,4 @@ -name: E2E Windows Light +name: E2E Windows --light on: schedule: @@ -51,13 +51,13 @@ jobs: - name: 🔠Display versions run: rake display_versions - - name: 🚀 Start node and wallet + - name: 🚀 Start wallet --light run: rake start_wallet_lite[%NETWORK%] - name: 🧪 Run all tests - run: rake spec + run: rake spec SPEC_OPTS="-t lite" - - name: ðŸ Stop node and wallet + - name: ðŸ Stop wallet --light run: rake stop_wallet_lite[%NETWORK%] - name: 📎 Upload logs From a2d00093c826aa8848d9e0d8f38b1af56a824919 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 1 Apr 2022 13:10:47 +0200 Subject: [PATCH 7/9] Change lite to light for consistency --- .github/workflows/e2e-linux-lite.yml | 6 +++--- .github/workflows/e2e-macos-lite.yml | 6 +++--- .github/workflows/e2e-windows-lite.yml | 6 +++--- test/e2e/.rake_tasks~ | 4 ++-- test/e2e/Rakefile | 24 ++++++++++++------------ test/e2e/spec/misc_spec.rb | 8 ++++---- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/e2e-linux-lite.yml b/.github/workflows/e2e-linux-lite.yml index d1369e997fa..96a2c906797 100644 --- a/.github/workflows/e2e-linux-lite.yml +++ b/.github/workflows/e2e-linux-lite.yml @@ -46,13 +46,13 @@ jobs: run: rake display_versions - name: 🚀 Start wallet --light - run: rake start_wallet_lite[$NETWORK] + run: rake start_wallet_light[$NETWORK] - name: 🧪 Run all tests - run: rake spec SPEC_OPTS="-t lite" + run: rake spec SPEC_OPTS="-t light" - name: ðŸ Stop wallet --light - run: rake stop_wallet_lite[$NETWORK] + run: rake stop_wallet_light[$NETWORK] - name: 📎 Upload logs uses: actions/upload-artifact@v2 diff --git a/.github/workflows/e2e-macos-lite.yml b/.github/workflows/e2e-macos-lite.yml index 70d25d2369a..7f3f87e4925 100644 --- a/.github/workflows/e2e-macos-lite.yml +++ b/.github/workflows/e2e-macos-lite.yml @@ -49,13 +49,13 @@ jobs: run: rake display_versions - name: 🚀 Start wallet --light - run: rake start_wallet_lite[$NETWORK] + run: rake start_wallet_light[$NETWORK] - name: 🧪 Run all tests - run: rake spec SPEC_OPTS="-t lite" + run: rake spec SPEC_OPTS="-t light" - name: ðŸ Stop wallet --light - run: rake stop_wallet_lite[$NETWORK] + run: rake stop_wallet_light[$NETWORK] - name: 📎 Upload logs uses: actions/upload-artifact@v2 diff --git a/.github/workflows/e2e-windows-lite.yml b/.github/workflows/e2e-windows-lite.yml index f17b561d5c0..c7b67e800bb 100644 --- a/.github/workflows/e2e-windows-lite.yml +++ b/.github/workflows/e2e-windows-lite.yml @@ -52,13 +52,13 @@ jobs: run: rake display_versions - name: 🚀 Start wallet --light - run: rake start_wallet_lite[%NETWORK%] + run: rake start_wallet_light[%NETWORK%] - name: 🧪 Run all tests - run: rake spec SPEC_OPTS="-t lite" + run: rake spec SPEC_OPTS="-t light" - name: ðŸ Stop wallet --light - run: rake stop_wallet_lite[%NETWORK%] + run: rake stop_wallet_light[%NETWORK%] - name: 📎 Upload logs uses: actions/upload-artifact@v2 diff --git a/test/e2e/.rake_tasks~ b/test/e2e/.rake_tasks~ index 2fa7c8eba54..08cedc850b6 100644 --- a/test/e2e/.rake_tasks~ +++ b/test/e2e/.rake_tasks~ @@ -13,6 +13,6 @@ spec setup start_node_and_wallet stop_node_and_wallet -start_wallet_lite -stop_wallet_lite +start_wallet_light +stop_wallet_light wait_until_node_synced diff --git a/test/e2e/Rakefile b/test/e2e/Rakefile index e43b8fb4aa1..6a9d3cef03f 100644 --- a/test/e2e/Rakefile +++ b/test/e2e/Rakefile @@ -208,8 +208,8 @@ task :stop_node_and_wallet, [:env] do |task, args| end -task :start_wallet_lite, [:env] do |task, args| - puts "\n >> Setting up cardano-wallet-lite" +task :start_wallet_light, [:env] do |task, args| + puts "\n >> Setting up cardano-wallet-light" bin_dir = BINS == '' ? BINS : "#{BINS}/" config_dir = File.join(CONFIGS, args[:env]) @@ -226,10 +226,10 @@ task :start_wallet_lite, [:env] do |task, args| f.write(wallet_cmd) end - install_wallet = "nssm install cardano-wallet-lite #{cd}/cardano-wallet.bat" - log_stdout_wallet = "nssm set cardano-wallet-lite AppStdout #{log_dir}/wallet.log" - log_stderr_wallet = "nssm set cardano-wallet-lite AppStderr #{log_dir}/wallet.log" - start_wallet = "nssm start cardano-wallet-lite" + install_wallet = "nssm install cardano-wallet-light #{cd}/cardano-wallet.bat" + log_stdout_wallet = "nssm set cardano-wallet-light AppStdout #{log_dir}/wallet.log" + log_stderr_wallet = "nssm set cardano-wallet-light AppStderr #{log_dir}/wallet.log" + start_wallet = "nssm start cardano-wallet-light" cmd install_wallet cmd log_stdout_wallet @@ -238,19 +238,19 @@ task :start_wallet_lite, [:env] do |task, args| else start_wallet = "#{bin_dir}cardano-wallet serve --port #{WALLET_PORT} --light --blockfrost-token-file #{BLOCKFROST_FILE} --testnet #{config_dir}/genesis-byron.json --database #{wallet_db_dir} --token-metadata-server #{TOKEN_METADATA}" - cmd "screen -dmS WALLET_#{args[:env]}_lite -L -Logfile #{log_dir}/wallet.log #{start_wallet}" + cmd "screen -dmS WALLET_#{args[:env]}_light -L -Logfile #{log_dir}/wallet.log #{start_wallet}" cmd "screen -ls", true end end -task :stop_wallet_lite, [:env] do |task, args| - puts "\n >> Stopping cardano-wallet-lite" +task :stop_wallet_light, [:env] do |task, args| + puts "\n >> Stopping cardano-wallet-light" if is_win? - cmd "nssm stop cardano-wallet-lite" - cmd "nssm remove cardano-wallet-lite confirm" + cmd "nssm stop cardano-wallet-light" + cmd "nssm remove cardano-wallet-light confirm" else - cmd "screen -XS WALLET_#{args[:env]}_lite quit" + cmd "screen -XS WALLET_#{args[:env]}_light quit" end end diff --git a/test/e2e/spec/misc_spec.rb b/test/e2e/spec/misc_spec.rb index 776db4095e8..d4ea68e64b5 100644 --- a/test/e2e/spec/misc_spec.rb +++ b/test/e2e/spec/misc_spec.rb @@ -7,7 +7,7 @@ expect(res).to be_correct_and_respond 200 end - it "Can check network clock offset", :lite do + it "Can check network clock offset", :light do res = NETWORK.clock expect(res).to be_correct_and_respond 200 end @@ -34,7 +34,7 @@ end end - describe CardanoWallet::Misc::Utils, :lite do + describe CardanoWallet::Misc::Utils, :light do describe "SMASH health" do it "SMASH health - unreachable" do @@ -266,7 +266,7 @@ end end - describe CardanoWallet::Misc::Proxy, :lite do + describe CardanoWallet::Misc::Proxy, :light do it "Malformed payload when tx is not binary" do pending "ADP-1145 - DecoderErrorDeserialiseFailure error message from the API /proxy/transactions" no_binary_blob = "test" @@ -276,7 +276,7 @@ end end - describe CardanoWallet::Misc::Settings, :lite do + describe CardanoWallet::Misc::Settings, :light do after(:all) do SETTINGS.update({ :pool_metadata_source => "none" }) From f2c0f7a93ff31050e4e95cf90e687af6a9d35d8c Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 1 Apr 2022 13:16:29 +0200 Subject: [PATCH 8/9] Update README --- test/e2e/README.md | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/test/e2e/README.md b/test/e2e/README.md index b5200d3d58e..aca60a92cb5 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -1,13 +1,10 @@ - - - - - - # E2E testing -[![E2E Docker](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-docker.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-docker.yml) [![E2E Linux](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-linux.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-linux.yml) [![E2E MacOS](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-macos.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-macos.yml) [![E2E Windows](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-windows.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-windows.yml) - -[![Docker-compose Linux](https://github.com/input-output-hk/cardano-wallet/actions/workflows/docker_linux.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/docker_linux.yml) [![Docker-compose MacOS](https://github.com/input-output-hk/cardano-wallet/actions/workflows/docker_macos.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/docker_macos.yml) +| | | +|--|--| +|**Full mode** |[![E2E Docker](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-docker.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-docker.yml) [![E2E Linux](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-linux.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-linux.yml) [![E2E MacOS](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-macos.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-macos.yml) [![E2E Windows](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-windows.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-windows.yml) | +|**Light mode** | [![E2E Linux --light](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-linux-lite.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-linux-lite.yml) [![E2E MacOS --light](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-macos-lite.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-macos-lite.yml) [![E2E Windows --light](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-windows-lite.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/e2e-windows-lite.yml) | +|**Docker compose** | [![Docker-compose Linux](https://github.com/input-output-hk/cardano-wallet/actions/workflows/docker_linux.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/docker_linux.yml) [![Docker-compose MacOS](https://github.com/input-output-hk/cardano-wallet/actions/workflows/docker_macos.yml/badge.svg)](https://github.com/input-output-hk/cardano-wallet/actions/workflows/docker_macos.yml) +| E2E functional tests of cardano-wallet are running nightly on [cardano testnet](https://testnets.cardano.org/en/cardano/overview/). Running tests against public testnet allows to exercise cardano-wallet on environment close to production (mainnet) utilizing and integrating maximally all components of the Cardano ecosystem like Stake pools, SMASH, metadata token server etc. @@ -22,11 +19,13 @@ In order to run tests one needs to [have ruby](https://www.ruby-lang.org/en/docu cd test/e2e bundle install ``` -2. Decrypt `fixture_wallets.json.gpg` containing mnemonics of testnet fixture wallets using `$TESTS_E2E_FIXTURES` secret. +2. Decrypt secret files using `$TESTS_E2E_FIXTURES` secret: + - `fixture_wallets.json.gpg` containing mnemonics of testnet fixture wallets + - `blockfrost.api.key.gpg` containing Blockfrost API key for `testnet` ```bash export TESTS_E2E_FIXTURES=******* -rake fixture_wallets_decode +rake secrets_decode ``` > :information_source: **_TESTS_E2E_FIXTURES_** secret is defined on https://github.com/input-output-hk/cardano-wallet/settings/secrets and also used by GH actions. Note that this step is also executed on very first test run. > @@ -38,7 +37,7 @@ $ rake run_on[testnet] This master task is performing also all the necessary configuration steps (i.e. getting latest testnet configs and wallet/node binaries from [Hydra](https://hydra.iohk.io/jobset/Cardano/cardano-wallet#tabs-jobs), starting everything up). All steps can also be executed as separate tasks , i.e.: ```bash -$ rake fixture_wallets_decode +$ rake secrets_decode $ rake get_latest_bins $ rake get_latest_configs[testnet] $ rake start_node_and_wallet[testnet] @@ -79,9 +78,21 @@ One can also run tests against `cardano-wallet` and `cardano-node` which are spe ```bash $ TESTS_E2E_BINDIR="" rake run_on[testnet] ``` - Running tests as such skips downloading latest binaries from Hydra. +#### Running tests against wallet started in `--light` mode + +One can also run some tests against wallet started in `--light` mode. Similar rake workflow can be applied except there is no need to start `cardano-node` and wait for it to be synced with the network: +```bash +$ rake secrets_decode +$ rake get_latest_bins +$ rake get_latest_configs[testnet] +$ rake start_wallet_light[testnet] +$ rake spec SPEC_OPTS="-t light" +$ rake stop_wallet_light[testnet] +``` +All tests that are suitable for `--light` mode are tagged with `:light` tag. + ### Test artifacts By default following locations are used for different artifacts used by the tests: From 93fcb9df3fc259afe2fa30c08f6ee94480cb0b86 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 1 Apr 2022 15:32:59 +0200 Subject: [PATCH 9/9] remove :light from Proxy test --- test/e2e/spec/misc_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/spec/misc_spec.rb b/test/e2e/spec/misc_spec.rb index d4ea68e64b5..32fabef9b31 100644 --- a/test/e2e/spec/misc_spec.rb +++ b/test/e2e/spec/misc_spec.rb @@ -266,7 +266,7 @@ end end - describe CardanoWallet::Misc::Proxy, :light do + describe CardanoWallet::Misc::Proxy do it "Malformed payload when tx is not binary" do pending "ADP-1145 - DecoderErrorDeserialiseFailure error message from the API /proxy/transactions" no_binary_blob = "test"