Skip to content

Commit

Permalink
Merge #3213
Browse files Browse the repository at this point in the history
  • Loading branch information
iohk-bors[bot] and Piotr Stachyra authored Apr 4, 2022
2 parents 6035ab5 + 93fcb9d commit 8fa352e
Show file tree
Hide file tree
Showing 11 changed files with 327 additions and 44 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/e2e-linux-lite.yml
Original file line number Diff line number Diff line change
@@ -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
run: rake start_wallet_light[$NETWORK]

- name: 🧪 Run all tests
run: rake spec SPEC_OPTS="-t light"

- name: 🏁 Stop wallet --light
run: rake stop_wallet_light[$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 || '' }}
70 changes: 70 additions & 0 deletions .github/workflows/e2e-macos-lite.yml
Original file line number Diff line number Diff line change
@@ -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 wallet --light
run: rake start_wallet_light[$NETWORK]

- name: 🧪 Run all tests
run: rake spec SPEC_OPTS="-t light"

- name: 🏁 Stop wallet --light
run: rake stop_wallet_light[$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 || '' }}
73 changes: 73 additions & 0 deletions .github/workflows/e2e-windows-lite.yml
Original file line number Diff line number Diff line change
@@ -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 wallet --light
run: rake start_wallet_light[%NETWORK%]

- name: 🧪 Run all tests
run: rake spec SPEC_OPTS="-t light"

- name: 🏁 Stop wallet --light
run: rake stop_wallet_light[%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' }}
1 change: 1 addition & 0 deletions test/e2e/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# secrets
/fixtures/fixture_wallets.json
/fixtures/blockfrost.api.key

# local environment variables
/.envrc-local
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/.rake_tasks~
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,4 +13,6 @@ spec
setup
start_node_and_wallet
stop_node_and_wallet
start_wallet_light
stop_wallet_light
wait_until_node_synced
37 changes: 24 additions & 13 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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.
>
Expand All @@ -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]
Expand Down Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 8fa352e

Please sign in to comment.