chore(test): drop usage of ganache in old E2E tests
The Ganache tool has been replaced by Hardhat: https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
c7e5dc75bc
commit
f8d78cdb95
|
@ -75,9 +75,6 @@ pipeline {
|
||||||
/* Container ports */
|
/* Container ports */
|
||||||
RPC_PORT = "${8545 + env.EXECUTOR_NUMBER.toInteger()}"
|
RPC_PORT = "${8545 + env.EXECUTOR_NUMBER.toInteger()}"
|
||||||
P2P_PORT = "${6010 + env.EXECUTOR_NUMBER.toInteger()}"
|
P2P_PORT = "${6010 + env.EXECUTOR_NUMBER.toInteger()}"
|
||||||
/* Ganache config */
|
|
||||||
GANACHE_RPC_PORT = "${9545 + env.EXECUTOR_NUMBER.toInteger()}"
|
|
||||||
GANACHE_MNEMONIC = 'pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial'
|
|
||||||
/* Runtime flag to make testing of the app easier. */
|
/* Runtime flag to make testing of the app easier. */
|
||||||
STATUS_RUNTIME_TEST_MODE = '1'
|
STATUS_RUNTIME_TEST_MODE = '1'
|
||||||
}
|
}
|
||||||
|
@ -97,29 +94,13 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Client') {
|
stage('Client') {
|
||||||
environment {
|
|
||||||
STATUS_RUNTIME_GANACHE_NETWORK_RPC_URL = "http://localhost:${env.GANACHE_RPC_PORT}"
|
|
||||||
}
|
|
||||||
steps { script {
|
steps { script {
|
||||||
linux.bundle('nim_status_client')
|
linux.bundle('nim_status_client')
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Containers') {
|
stage('Nim-Waku') {
|
||||||
parallel {
|
steps { script {
|
||||||
stage('Ganache') { steps { script {
|
|
||||||
ganache = docker.image(
|
|
||||||
'trufflesuite/ganache:v7.4.1'
|
|
||||||
).run(
|
|
||||||
["-p 127.0.0.1:${env.GANACHE_RPC_PORT}:8545",
|
|
||||||
"-v ${env.WORKSPACE}/test/ui-test/fixtures/ganache-dbs/goerli:/goerli-db"].join(' '),
|
|
||||||
["-m='${GANACHE_MNEMONIC}'", "-e=10",
|
|
||||||
'--chain.chainId=5',
|
|
||||||
'--database.dbPath=/goerli-db'].join(' ')
|
|
||||||
)
|
|
||||||
} } }
|
|
||||||
|
|
||||||
stage('Nim-Waku') { steps { script {
|
|
||||||
nimwaku = docker.image(
|
nimwaku = docker.image(
|
||||||
'statusteam/nim-waku:v0.13.0'
|
'statusteam/nim-waku:v0.13.0'
|
||||||
).run(
|
).run(
|
||||||
|
@ -133,8 +114,7 @@ pipeline {
|
||||||
'--nat=none'].join(' ')
|
'--nat=none'].join(' ')
|
||||||
)
|
)
|
||||||
env.TEST_PEER_ENR = getPeerAddress()
|
env.TEST_PEER_ENR = getPeerAddress()
|
||||||
} } }
|
} }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
|
@ -169,10 +149,7 @@ pipeline {
|
||||||
} }
|
} }
|
||||||
} }
|
} }
|
||||||
post {
|
post {
|
||||||
failure { script {
|
failure { script { sh("docker logs ${nimwaku.id}") } }
|
||||||
sh("docker logs ${nimwaku.id}")
|
|
||||||
sh("docker logs ${ganache.id}")
|
|
||||||
} }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +166,6 @@ pipeline {
|
||||||
} }
|
} }
|
||||||
cleanup { script {
|
cleanup { script {
|
||||||
sh './scripts/clean-git.sh'
|
sh './scripts/clean-git.sh'
|
||||||
if (binding.hasVariable('ganache')) { ganache.stop() }
|
|
||||||
if (binding.hasVariable('nimwaku')) { nimwaku.stop() }
|
if (binding.hasVariable('nimwaku')) { nimwaku.stop() }
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,124 +140,6 @@ var NETWORKS* = %* [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
if GANACHE_NETWORK_RPC_URL != "":
|
|
||||||
NETWORKS = %* [
|
|
||||||
{
|
|
||||||
"chainId": 1,
|
|
||||||
"chainName": "Mainnet",
|
|
||||||
"rpcUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"fallbackUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"blockExplorerUrl": "https://etherscan.io/",
|
|
||||||
"iconUrl": "network/Network=Ethereum",
|
|
||||||
"chainColor": "#627EEA",
|
|
||||||
"shortName": "eth",
|
|
||||||
"nativeCurrencyName": "Ether",
|
|
||||||
"nativeCurrencySymbol": "ETH",
|
|
||||||
"nativeCurrencyDecimals": 18,
|
|
||||||
"isTest": false,
|
|
||||||
"layer": 1,
|
|
||||||
"enabled": true,
|
|
||||||
"tokenOverrides": [
|
|
||||||
{
|
|
||||||
"symbol": "SNT",
|
|
||||||
"address": "0x8571Ddc46b10d31EF963aF49b6C7799Ea7eff818"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"relatedChainId": 5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"chainId": 5,
|
|
||||||
"chainName": "Mainnet",
|
|
||||||
"rpcUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"fallbackUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"blockExplorerUrl": "https://goerli.etherscan.io/",
|
|
||||||
"iconUrl": "network/Network=Ethereum",
|
|
||||||
"chainColor": "#627EEA",
|
|
||||||
"shortName": "eth",
|
|
||||||
"nativeCurrencyName": "Ether",
|
|
||||||
"nativeCurrencySymbol": "ETH",
|
|
||||||
"nativeCurrencyDecimals": 18,
|
|
||||||
"isTest": true,
|
|
||||||
"layer": 1,
|
|
||||||
"enabled": true,
|
|
||||||
"tokenOverrides": [
|
|
||||||
{
|
|
||||||
"symbol": "STT",
|
|
||||||
"address": "0x8571Ddc46b10d31EF963aF49b6C7799Ea7eff818"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"relatedChainId": 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"chainId": 10,
|
|
||||||
"chainName": "Optimism",
|
|
||||||
"rpcUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"fallbackUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"blockExplorerUrl": "https://optimistic.etherscan.io",
|
|
||||||
"iconUrl": "network/Network=Optimism",
|
|
||||||
"chainColor": "#E90101",
|
|
||||||
"shortName": "opt",
|
|
||||||
"nativeCurrencyName": "Ether",
|
|
||||||
"nativeCurrencySymbol": "ETH",
|
|
||||||
"nativeCurrencyDecimals": 18,
|
|
||||||
"isTest": false,
|
|
||||||
"layer": 2,
|
|
||||||
"enabled": true,
|
|
||||||
"relatedChainId": 420,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"chainId": 420,
|
|
||||||
"chainName": "Optimism",
|
|
||||||
"rpcUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"fallbackUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"blockExplorerUrl": "https://goerli-optimism.etherscan.io/",
|
|
||||||
"iconUrl": "network/Network=Optimism",
|
|
||||||
"chainColor": "#E90101",
|
|
||||||
"shortName": "opt",
|
|
||||||
"nativeCurrencyName": "Ether",
|
|
||||||
"nativeCurrencySymbol": "ETH",
|
|
||||||
"nativeCurrencyDecimals": 18,
|
|
||||||
"isTest": true,
|
|
||||||
"layer": 2,
|
|
||||||
"enabled": false,
|
|
||||||
"relatedChainId": 10,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"chainId": 42161,
|
|
||||||
"chainName": "Arbitrum",
|
|
||||||
"rpcUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"fallbackUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"blockExplorerUrl": "https://arbiscan.io/",
|
|
||||||
"iconUrl": "network/Network=Arbitrum",
|
|
||||||
"chainColor": "#51D0F0",
|
|
||||||
"shortName": "arb",
|
|
||||||
"nativeCurrencyName": "Ether",
|
|
||||||
"nativeCurrencySymbol": "ETH",
|
|
||||||
"nativeCurrencyDecimals": 18,
|
|
||||||
"isTest": false,
|
|
||||||
"layer": 2,
|
|
||||||
"enabled": true,
|
|
||||||
"relatedChainId": 421613,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"chainId": 421613,
|
|
||||||
"chainName": "Arbitrum",
|
|
||||||
"rpcUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"fallbackUrl": GANACHE_NETWORK_RPC_URL,
|
|
||||||
"blockExplorerUrl": "https://goerli.arbiscan.io/",
|
|
||||||
"iconUrl": "network/Network=Arbitrum",
|
|
||||||
"chainColor": "#51D0F0",
|
|
||||||
"shortName": "arb",
|
|
||||||
"nativeCurrencyName": "Ether",
|
|
||||||
"nativeCurrencySymbol": "ETH",
|
|
||||||
"nativeCurrencyDecimals": 18,
|
|
||||||
"isTest": true,
|
|
||||||
"layer": 2,
|
|
||||||
"enabled": false,
|
|
||||||
"relatedChainId": 42161,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
var NODE_CONFIG* = %* {
|
var NODE_CONFIG* = %* {
|
||||||
"BrowsersConfig": {
|
"BrowsersConfig": {
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
|
|
|
@ -37,7 +37,6 @@ let
|
||||||
# runtime variables
|
# runtime variables
|
||||||
TEST_MODE_ENABLED* = desktopConfig.testMode
|
TEST_MODE_ENABLED* = desktopConfig.testMode
|
||||||
WALLET_ENABLED* = desktopConfig.enableWallet
|
WALLET_ENABLED* = desktopConfig.enableWallet
|
||||||
GANACHE_NETWORK_RPC_URL* = desktopConfig.genacheNetworkRpcUrl
|
|
||||||
TORRENT_CONFIG_PORT* = desktopConfig.defaultTorentConfigPort
|
TORRENT_CONFIG_PORT* = desktopConfig.defaultTorentConfigPort
|
||||||
WAKU_V2_PORT* = desktopConfig.defaultWakuV2Port
|
WAKU_V2_PORT* = desktopConfig.defaultWakuV2Port
|
||||||
STATUS_PORT* = desktopConfig.statusPort
|
STATUS_PORT* = desktopConfig.statusPort
|
||||||
|
|
|
@ -143,11 +143,6 @@ type StatusDesktopConfig = object
|
||||||
desc: "Determines if the wallet section is enabled"
|
desc: "Determines if the wallet section is enabled"
|
||||||
name: "ENABLE_WALLET"
|
name: "ENABLE_WALLET"
|
||||||
abbr: "enable-wallet" .}: bool
|
abbr: "enable-wallet" .}: bool
|
||||||
genacheNetworkRpcUrl* {.
|
|
||||||
defaultValue: ""
|
|
||||||
desc: "Sets ganache network rpc url"
|
|
||||||
name: "GANACHE_NETWORK_RPC_URL"
|
|
||||||
abbr: "ganache-network-rpc-url" .}: string
|
|
||||||
defaultTorentConfigPort* {.
|
defaultTorentConfigPort* {.
|
||||||
defaultValue: 0
|
defaultValue: 0
|
||||||
desc: "Sets default torrent config port"
|
desc: "Sets default torrent config port"
|
||||||
|
|
|
@ -356,7 +356,6 @@ TEST(WalletApi, TestGetTokensBalancesForChainIDs_WatchOnlyAccount)
|
||||||
ASSERT_GT(addressBalance.at(sntMain.address), 0);
|
ASSERT_GT(addressBalance.at(sntMain.address), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this is a debugging test. Augment it with local Ganache environment to have a reliable integration test
|
|
||||||
TEST(WalletApi, TestCheckRecentHistory)
|
TEST(WalletApi, TestCheckRecentHistory)
|
||||||
{
|
{
|
||||||
ScopedTestAccount testAccount(test_info_->name());
|
ScopedTestAccount testAccount(test_info_->name());
|
||||||
|
@ -399,7 +398,6 @@ TEST(WalletApi, TestCheckRecentHistory)
|
||||||
ASSERT_TRUE(historyReady);
|
ASSERT_TRUE(historyReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this is a debugging test. Augment it with local Ganache environment to have a reliable integration test
|
|
||||||
TEST(WalletApi, TestGetBalanceHistory)
|
TEST(WalletApi, TestGetBalanceHistory)
|
||||||
{
|
{
|
||||||
ScopedTestAccount testAccount(test_info_->name());
|
ScopedTestAccount testAccount(test_info_->name());
|
||||||
|
@ -538,7 +536,6 @@ TEST(WalletApi, TestGetBalanceHistory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this is a debugging test. Augment it with local Ganache environment to have a reliable integration test
|
|
||||||
TEST(WalletApi, TestStartWallet)
|
TEST(WalletApi, TestStartWallet)
|
||||||
{
|
{
|
||||||
ScopedTestAccount testAccount(test_info_->name());
|
ScopedTestAccount testAccount(test_info_->name());
|
||||||
|
@ -589,7 +586,6 @@ TEST(WalletApi, TestStartWallet)
|
||||||
ASSERT_EQ(bhEndedReceivedCount, 2);
|
ASSERT_EQ(bhEndedReceivedCount, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this is a debugging test. Augment it with local Ganache environment to have a reliable integration test
|
|
||||||
TEST(WalletApi, TestStopBalanceHistory)
|
TEST(WalletApi, TestStopBalanceHistory)
|
||||||
{
|
{
|
||||||
ScopedTestAccount testAccount(test_info_->name());
|
ScopedTestAccount testAccount(test_info_->name());
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: '2.1'
|
|
||||||
services:
|
|
||||||
uitestganache:
|
|
||||||
image: trufflesuite/ganache:v7.4.1
|
|
||||||
ports:
|
|
||||||
- 127.0.0.1:${GANACHE_RPC_PORT}:8545
|
|
||||||
volumes:
|
|
||||||
- ${GANACHE_DB_FOLDER}:/test_data/goerli-db
|
|
||||||
command: ["-m='${GANACHE_MNEMONIC}'", "-e=10", "--chain.chainId=5", "--database.dbPath=/test_data/goerli-db"]
|
|
|
@ -1,21 +0,0 @@
|
||||||
# Developer helpers to run ganache dependent test cases locally
|
|
||||||
|
|
||||||
Ganache is used in tests to avoid depending on RPC internet calls
|
|
||||||
|
|
||||||
In CI ganache is started as a docker container directly from the [test suite](../../../../../ci/Jenkinsfile.e2e) (see stage `Containers`). In order to run locally you need to start ganache manually with the same options as Jenkins environment.
|
|
||||||
|
|
||||||
## How to run e2e tests locally
|
|
||||||
|
|
||||||
Optionally edit [`.env`](./.env) file to match your personal setup if the defaults don't work for you. The file is loaded by `desktop-compose` from the run step.
|
|
||||||
|
|
||||||
Running
|
|
||||||
|
|
||||||
- Compile to include the squish specific configuration like this `GANACHE_NETWORK_RPC_URL="http://localhost:9545" make -j10`
|
|
||||||
- This is required because `GANACHE_NETWORK_RPC_URL` is a `const` Nim variable and cannot be changed at runtime (`make clean` if binary is already built without the `GANACHE_NETWORK_RPC_URL`)
|
|
||||||
- Upon this step the production `NETWORKS` configuration in `status-desktop/src/app_service/common/network_constants.nim` is overridden with the second pair that includes the `GANACHE_NETWORK_RPC_URL` variable for all nodes along with specific token contract override for `SNT` and `STT`
|
|
||||||
- Start ganache docker environment `docker-compose up uitestganache`
|
|
||||||
- Run squish desired tests (if all is setup correctly, you should see RPC output calls in the `docker-compose up` output)
|
|
||||||
|
|
||||||
**Beware** that the default `.env` will alter the in sources test data. Using the in-sources test data folder makes it is easy to add changes to the git index.
|
|
||||||
|
|
||||||
- Solution: a copy of the `<status-desktop>/test/ui-test/fixtures/ganache-dbs/goerli` can be made outside sources and docker-compose redirected to use a personal `.env` file (using the `--env-file` option) pointing to the personal clone of the test data folder.
|
|
Loading…
Reference in New Issue