@cardano-sdk/e2e 0.44.2 → 0.44.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +10 -10
- package/src/scripts/generate-dotenv.sh +46 -15
- package/test/k6/scenarios/web-socket.test.js +33 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.44.4](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/e2e@0.44.3...@cardano-sdk/e2e@0.44.4) (2024-10-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @cardano-sdk/e2e
|
|
9
|
+
|
|
10
|
+
## [0.44.3](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/e2e@0.44.2...@cardano-sdk/e2e@0.44.3) (2024-10-09)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @cardano-sdk/e2e
|
|
13
|
+
|
|
6
14
|
## [0.44.2](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/e2e@0.44.1...@cardano-sdk/e2e@0.44.2) (2024-10-07)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @cardano-sdk/e2e
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardano-sdk/e2e",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.4",
|
|
4
4
|
"description": "End to end tests for the cardano-js-sdk packages.",
|
|
5
5
|
"repository": "https://github.com/input-output-hk/cardano-js-sdk",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -76,20 +76,20 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@cardano-foundation/ledgerjs-hw-app-cardano": "^7.1.2",
|
|
78
78
|
"@cardano-ogmios/client": "6.5.0",
|
|
79
|
-
"@cardano-sdk/cardano-services": "~0.31.
|
|
80
|
-
"@cardano-sdk/cardano-services-client": "~0.21.
|
|
79
|
+
"@cardano-sdk/cardano-services": "~0.31.3",
|
|
80
|
+
"@cardano-sdk/cardano-services-client": "~0.21.3",
|
|
81
81
|
"@cardano-sdk/core": "~0.41.0",
|
|
82
82
|
"@cardano-sdk/crypto": "~0.1.30",
|
|
83
83
|
"@cardano-sdk/hardware-ledger": "~0.12.8",
|
|
84
84
|
"@cardano-sdk/hardware-trezor": "~0.6.7",
|
|
85
85
|
"@cardano-sdk/input-selection": "~0.13.23",
|
|
86
86
|
"@cardano-sdk/key-management": "~0.24.6",
|
|
87
|
-
"@cardano-sdk/ogmios": "~0.18.
|
|
87
|
+
"@cardano-sdk/ogmios": "~0.18.5",
|
|
88
88
|
"@cardano-sdk/tx-construction": "~0.21.8",
|
|
89
89
|
"@cardano-sdk/util": "~0.15.5",
|
|
90
|
-
"@cardano-sdk/util-dev": "~0.23.
|
|
90
|
+
"@cardano-sdk/util-dev": "~0.23.5",
|
|
91
91
|
"@cardano-sdk/util-rxjs": "~0.7.36",
|
|
92
|
-
"@cardano-sdk/wallet": "~0.44.
|
|
92
|
+
"@cardano-sdk/wallet": "~0.44.10",
|
|
93
93
|
"@dcspark/cardano-multiplatform-lib-nodejs": "^3.1.1",
|
|
94
94
|
"@shiroyasha9/axios-fetch-adapter": "1.0.3",
|
|
95
95
|
"axios": "^1.7.4",
|
|
@@ -120,9 +120,9 @@
|
|
|
120
120
|
"@babel/preset-env": "^7.18.2",
|
|
121
121
|
"@babel/preset-typescript": "^7.17.12",
|
|
122
122
|
"@cardano-sdk/dapp-connector": "~0.12.40",
|
|
123
|
-
"@cardano-sdk/projection": "~0.12.
|
|
124
|
-
"@cardano-sdk/projection-typeorm": "~0.9.
|
|
125
|
-
"@cardano-sdk/web-extension": "~0.34.
|
|
123
|
+
"@cardano-sdk/projection": "~0.12.5",
|
|
124
|
+
"@cardano-sdk/projection-typeorm": "~0.9.5",
|
|
125
|
+
"@cardano-sdk/web-extension": "~0.34.9",
|
|
126
126
|
"@dcspark/cardano-multiplatform-lib-browser": "^3.1.1",
|
|
127
127
|
"@emurgo/cardano-message-signing-asmjs": "^1.0.1",
|
|
128
128
|
"@types/bunyan": "^1.8.8",
|
|
@@ -182,5 +182,5 @@
|
|
|
182
182
|
"publishConfig": {
|
|
183
183
|
"access": "public"
|
|
184
184
|
},
|
|
185
|
-
"gitHead": "
|
|
185
|
+
"gitHead": "2e0e2c79bf24475ca7ceaefa16118b283c43e21f"
|
|
186
186
|
}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
set -e
|
|
4
|
-
set -x
|
|
5
|
-
set -o
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
target="${ENVIRONMENT}-${NETWORK}"
|
|
6
|
+
|
|
7
|
+
case $CLUSTER in
|
|
8
8
|
any)
|
|
9
|
-
environment="$
|
|
9
|
+
environment="${target}"
|
|
10
|
+
;;
|
|
11
|
+
*)
|
|
12
|
+
environment="${target}.${CLUSTER}"
|
|
13
|
+
;;
|
|
14
|
+
esac
|
|
15
|
+
|
|
16
|
+
case $NETWORK in
|
|
17
|
+
preprod)
|
|
18
|
+
networkMagic=1
|
|
19
|
+
;;
|
|
20
|
+
preview)
|
|
21
|
+
networkMagic=2
|
|
22
|
+
;;
|
|
23
|
+
sanchonet)
|
|
24
|
+
networkMagic=4
|
|
10
25
|
;;
|
|
11
26
|
*)
|
|
12
|
-
|
|
27
|
+
echo "${NETWORK}: Unknown network"
|
|
28
|
+
exit 1
|
|
13
29
|
;;
|
|
14
30
|
esac
|
|
15
31
|
|
|
@@ -17,32 +33,47 @@ domain="${environment}.lw.iog.io"
|
|
|
17
33
|
url="https://${domain}/"
|
|
18
34
|
|
|
19
35
|
# Construct the environment file content
|
|
20
|
-
envFileContent="
|
|
21
|
-
# Logger
|
|
36
|
+
envFileContent="\
|
|
22
37
|
LOGGER_MIN_SEVERITY=info
|
|
23
38
|
|
|
24
|
-
# Key management setup - required by getWallet
|
|
25
|
-
KEY_MANAGEMENT_PROVIDER=inMemory
|
|
26
|
-
|
|
27
|
-
# Providers setup - required by getWallet
|
|
28
39
|
TEST_CLIENT_ASSET_PROVIDER=http
|
|
29
40
|
TEST_CLIENT_ASSET_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
|
|
30
|
-
TEST_CLIENT_CHAIN_HISTORY_PROVIDER=
|
|
41
|
+
TEST_CLIENT_CHAIN_HISTORY_PROVIDER=ws
|
|
31
42
|
TEST_CLIENT_CHAIN_HISTORY_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
|
|
32
43
|
TEST_CLIENT_HANDLE_PROVIDER=http
|
|
33
44
|
TEST_CLIENT_HANDLE_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
|
|
34
|
-
TEST_CLIENT_NETWORK_INFO_PROVIDER=
|
|
45
|
+
TEST_CLIENT_NETWORK_INFO_PROVIDER=ws
|
|
35
46
|
TEST_CLIENT_NETWORK_INFO_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
|
|
36
47
|
TEST_CLIENT_REWARDS_PROVIDER=http
|
|
37
48
|
TEST_CLIENT_REWARDS_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
|
|
38
49
|
TEST_CLIENT_TX_SUBMIT_PROVIDER=http
|
|
39
50
|
TEST_CLIENT_TX_SUBMIT_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
|
|
40
|
-
TEST_CLIENT_UTXO_PROVIDER=
|
|
51
|
+
TEST_CLIENT_UTXO_PROVIDER=ws
|
|
41
52
|
TEST_CLIENT_UTXO_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
|
|
42
53
|
TEST_CLIENT_STAKE_POOL_PROVIDER=http
|
|
43
54
|
TEST_CLIENT_STAKE_POOL_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
|
|
44
55
|
WS_PROVIDER_URL='wss://${domain}/ws'
|
|
45
|
-
|
|
56
|
+
|
|
57
|
+
KEY_MANAGEMENT_PROVIDER=inMemory
|
|
58
|
+
KEY_MANAGEMENT_PARAMS='{
|
|
59
|
+
\"bip32Ed25519\": \"Sodium\",
|
|
60
|
+
\"accountIndex\": 0,
|
|
61
|
+
\"chainId\": {
|
|
62
|
+
\"networkId\": 0,
|
|
63
|
+
\"networkMagic\": ${networkMagic}
|
|
64
|
+
},
|
|
65
|
+
\"passphrase\": \"some_passphrase\",
|
|
66
|
+
\"mnemonic\": \"${MNEMONIC}\"
|
|
67
|
+
}'"
|
|
46
68
|
|
|
47
69
|
# Write the environment file content to the specified file
|
|
48
70
|
echo "$envFileContent" > .env
|
|
71
|
+
|
|
72
|
+
# Dump inputs and outputs
|
|
73
|
+
echo "
|
|
74
|
+
Target environment: ${ENVIRONMENT}
|
|
75
|
+
Target network: ${NETWORK}
|
|
76
|
+
Target cluster: ${CLUSTER}
|
|
77
|
+
|
|
78
|
+
Result .env:"
|
|
79
|
+
cat .env
|
|
@@ -6,8 +6,16 @@ import { SharedArray } from 'k6/data';
|
|
|
6
6
|
import { check } from 'k6';
|
|
7
7
|
import ws from 'k6/ws';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
{
|
|
9
|
+
const parameters = Object.assign(
|
|
10
|
+
{
|
|
11
|
+
CONNECTIONS_SECONDS: '3',
|
|
12
|
+
HD_ACTIVE_ADDR_COUNT: '10',
|
|
13
|
+
HD_MAX_TX_HISTORY: '100',
|
|
14
|
+
IDLE_SECONDS: '60',
|
|
15
|
+
TARGET_NET: 'mainnet',
|
|
16
|
+
WALLET_RESTORATION: 'false',
|
|
17
|
+
WALLETS: '100'
|
|
18
|
+
},
|
|
11
19
|
// eslint-disable-next-line no-undef
|
|
12
20
|
__ENV
|
|
13
21
|
);
|
|
@@ -16,9 +24,12 @@ const { HD_ACTIVE_ADDR_COUNT, HD_MAX_TX_HISTORY, TARGET_NET, WALLETS } = Object.
|
|
|
16
24
|
const dut = k6Utils.getDut(__ENV, { networks: ['mainnet', 'preprod'] });
|
|
17
25
|
const url = `wss://${dut}/ws`;
|
|
18
26
|
|
|
19
|
-
const activeAddrCount = Number.parseInt(HD_ACTIVE_ADDR_COUNT, 10);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
27
|
+
const activeAddrCount = Number.parseInt(parameters.HD_ACTIVE_ADDR_COUNT, 10);
|
|
28
|
+
const idleSeconds = Number.parseInt(parameters.IDLE_SECONDS, 10);
|
|
29
|
+
const connectionsSeconds = Number.parseInt(parameters.CONNECTIONS_SECONDS, 10);
|
|
30
|
+
const maxTxHistory = Number.parseInt(parameters.HD_MAX_TX_HISTORY, 10);
|
|
31
|
+
const numWallets = Number.parseInt(parameters.WALLETS, 10);
|
|
32
|
+
const walletRestoration = parameters.WALLETS === 'true';
|
|
22
33
|
|
|
23
34
|
export const options = {
|
|
24
35
|
ext: {
|
|
@@ -31,15 +42,15 @@ export const options = {
|
|
|
31
42
|
connections: {
|
|
32
43
|
executor: 'ramping-vus',
|
|
33
44
|
gracefulRampDown: '0s',
|
|
34
|
-
gracefulStop: '
|
|
35
|
-
stages: [{ duration:
|
|
45
|
+
gracefulStop: '60m',
|
|
46
|
+
stages: [{ duration: `${connectionsSeconds}s`, target: numWallets }],
|
|
36
47
|
startVUs: 1
|
|
37
48
|
}
|
|
38
49
|
}
|
|
39
50
|
};
|
|
40
51
|
|
|
41
52
|
/** Wallet addresses extracted from the JSON dump file */
|
|
42
|
-
const fileName = `../../dump/addresses/${TARGET_NET}.json`;
|
|
53
|
+
const fileName = `../../dump/addresses/${parameters.TARGET_NET}.json`;
|
|
43
54
|
// eslint-disable-next-line no-undef
|
|
44
55
|
const walletsOrig = new SharedArray('walletsData', () => JSON.parse(open(fileName)));
|
|
45
56
|
|
|
@@ -77,7 +88,9 @@ export const run = ({ wallets }) => {
|
|
|
77
88
|
const vu = __VU;
|
|
78
89
|
const wallet = wallets[vu % wallets.length]; // each wallet is a collection of addresses
|
|
79
90
|
|
|
91
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
80
92
|
const res = ws.connect(url, null, (socket) => {
|
|
93
|
+
let blockNo = 0;
|
|
81
94
|
let closed = false;
|
|
82
95
|
let requestId = 0;
|
|
83
96
|
let transactionsCount = 0;
|
|
@@ -92,7 +105,7 @@ export const run = ({ wallets }) => {
|
|
|
92
105
|
return socket.setTimeout(() => {
|
|
93
106
|
closed = true;
|
|
94
107
|
socket.close();
|
|
95
|
-
}, 1000);
|
|
108
|
+
}, idleSeconds * 1000);
|
|
96
109
|
}
|
|
97
110
|
|
|
98
111
|
const address =
|
|
@@ -100,15 +113,23 @@ export const run = ({ wallets }) => {
|
|
|
100
113
|
? wallet[requestId - 1].address
|
|
101
114
|
: getDummyAddr(wallet[0].address, requestId - wallet.length);
|
|
102
115
|
|
|
103
|
-
|
|
116
|
+
const lower = walletRestoration ? 0 : blockNo;
|
|
117
|
+
|
|
118
|
+
socket.send(JSON.stringify({ requestId, txsByAddresses: { addresses: [address], lower } }));
|
|
104
119
|
};
|
|
105
120
|
|
|
106
121
|
socket.on('message', (message) => {
|
|
107
|
-
const { clientId, responseTo, transactions } = JSON.parse(message);
|
|
122
|
+
const { clientId, networkInfo, responseTo, transactions } = JSON.parse(message);
|
|
108
123
|
|
|
124
|
+
// Set operational stat
|
|
109
125
|
if (clientId) operationalTrend.add(Date.now() - begin);
|
|
126
|
+
|
|
127
|
+
// Perform init with or without restoration
|
|
128
|
+
if (networkInfo) ({ blockNo } = networkInfo.ledgerTip);
|
|
110
129
|
if (clientId || responseTo) nextAddress();
|
|
111
|
-
|
|
130
|
+
|
|
131
|
+
// Count the incoming transactions
|
|
132
|
+
if (Array.isArray(transactions)) transactionsCount += transactions.length;
|
|
112
133
|
});
|
|
113
134
|
|
|
114
135
|
// Count unexpected close
|