Skip to content

Commit 776314a

Browse files
committed
test: add option to choose target cluster for deployed environments e2e tests
1 parent 92ea4d9 commit 776314a

File tree

3 files changed

+60
-18
lines changed

3 files changed

+60
-18
lines changed

.github/workflows/test-deploy-e2e.yaml

+30-8
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,32 @@ on:
99
required: true
1010
default: 'dev-preprod'
1111
options:
12-
- live-preprod
13-
- live-preview
14-
- dev-preprod
15-
- dev-preview
16-
- staging-preprod
12+
- live-preprod
13+
- live-preview
14+
- dev-preprod
15+
- dev-preview
16+
- staging-preprod
17+
cluster:
18+
description: 'Specific cluster to run e2e tests against'
19+
type: choice
20+
required: true
21+
default: 'any'
22+
options:
23+
- any
24+
- eu-central-1
25+
- us-east-2
26+
level:
27+
description: 'Log level'
28+
type: choice
29+
required: true
30+
default: 'fatal'
31+
options:
32+
- fatal
33+
- error
34+
- warn
35+
- info
36+
- debug
37+
- trace
1738

1839
env:
1940
TL_DEPTH: ${{ github.event.pull_request.head.repo.fork && '0' || fromJson(vars.TL_DEPTH) }}
@@ -33,7 +54,7 @@ jobs:
3354
working-directory: ./packages/e2e/
3455
run: |
3556
if [[ "${{ inputs.environment }}" == *"preprod"* ]]; then networkMagic=1; else networkMagic=2; fi
36-
./src/scripts/generate-dotenv.sh ${{ inputs.environment }}
57+
./src/scripts/generate-dotenv.sh ${{ inputs.environment }} ${{ inputs.cluster }}
3758
echo "KEY_MANAGEMENT_PARAMS='$(jq --argjson networkMagic $networkMagic --arg mnemonic "${{ secrets.MNEMONIC }}" <<< '{"bip32Ed25519": "Sodium", "accountIndex": 0, "chainId":{"networkId": 0, "networkMagic": 0}, "passphrase":"some_passphrase","mnemonic":"mnemonics"}' '.mnemonic=$mnemonic | .chainId.networkMagic=$networkMagic')'" >> .env
3859
3960
- name: 🧰 Setup Node.js
@@ -49,6 +70,7 @@ jobs:
4970
env:
5071
NODE_OPTIONS: '--max_old_space_size=8192'
5172

52-
- name: 🔬 Test - e2e - wallet at epoch 0
73+
- name: 🔬 Test - e2e - wallet
5374
run: |
54-
yarn workspace @cardano-sdk/e2e test:wallet
75+
TL_DEPTH=0 TL_LEVEL=${{ inputs.level }} yarn workspace @cardano-sdk/e2e test:wallet-real-ada
76+
shell: bash

packages/e2e/src/scripts/generate-dotenv.sh

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
#!/bin/bash
2+
3+
set -e
24
set -x
35
set -o
46

5-
environment="$1"
7+
case $2 in
8+
any)
9+
environment="$1"
10+
;;
11+
*)
12+
environment="$1.$2"
13+
;;
14+
esac
615

7-
url="https://${environment}.lw.iog.io"
16+
domain="${environment}.lw.iog.io"
17+
url="https://${domain}/"
818

919
# Construct the environment file content
1020
envFileContent="
@@ -16,19 +26,24 @@ KEY_MANAGEMENT_PROVIDER=inMemory
1626
1727
# Providers setup - required by getWallet
1828
ASSET_PROVIDER=http
19-
ASSET_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
29+
ASSET_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
30+
CHAIN_HISTORY_PROVIDER=http
31+
CHAIN_HISTORY_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
2032
HANDLE_PROVIDER=http
21-
HANDLE_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4011/\"}'
33+
HANDLE_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
2234
NETWORK_INFO_PROVIDER=http
23-
NETWORK_INFO_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
35+
NETWORK_INFO_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
2436
REWARDS_PROVIDER=http
25-
REWARDS_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
37+
REWARDS_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
2638
TX_SUBMIT_PROVIDER=http
27-
TX_SUBMIT_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
39+
TX_SUBMIT_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
2840
UTXO_PROVIDER=http
29-
UTXO_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
41+
UTXO_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
3042
STAKE_POOL_PROVIDER=http
31-
STAKE_POOL_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
43+
STAKE_POOL_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
44+
WS_PROVIDER_URL='wss://${domain}/ws'
45+
46+
PRE_CONWAY=stable
3247
"
3348

3449
# Write the environment file content to the specified file

packages/e2e/src/util/util.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ export const normalizeTxBody = (body: Cardano.HydratedTxBody | Cardano.TxBody) =
9090
return dehydratedTx;
9191
};
9292

93+
// We do not afford to wait for 3 confirmations on real network as it is a too long wait.
94+
// In preview it happened more than 4 minutes required to have 3 confirmations,
95+
// making the test to fail for timeout waiting for the third confirmation.
96+
const defaultWaitConfirmation = env.NETWORK_SPEED === 'fast' ? 3 : 1;
97+
9398
export const txConfirmed = (
9499
{
95100
tip$,
@@ -99,7 +104,7 @@ export const txConfirmed = (
99104
}
100105
}: ObservableWallet,
101106
{ id }: Pick<Cardano.Tx, 'id'>,
102-
numConfirmations = 3
107+
numConfirmations = defaultWaitConfirmation
103108
) =>
104109
firstValueFromTimed(
105110
merge(

0 commit comments

Comments
 (0)