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 */
|
||||
RPC_PORT = "${8545 + 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. */
|
||||
STATUS_RUNTIME_TEST_MODE = '1'
|
||||
}
|
||||
|
@ -97,44 +94,27 @@ pipeline {
|
|||
}
|
||||
|
||||
stage('Client') {
|
||||
environment {
|
||||
STATUS_RUNTIME_GANACHE_NETWORK_RPC_URL = "http://localhost:${env.GANACHE_RPC_PORT}"
|
||||
}
|
||||
steps { script {
|
||||
linux.bundle('nim_status_client')
|
||||
} }
|
||||
}
|
||||
|
||||
stage('Containers') {
|
||||
parallel {
|
||||
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(
|
||||
'statusteam/nim-waku:v0.13.0'
|
||||
).run(
|
||||
["-p 127.0.0.1:${env.RPC_PORT}:8545",
|
||||
"-p 127.0.0.1:${env.P2P_PORT}:30303/tcp",
|
||||
"-p 127.0.0.1:${env.P2P_PORT}:30303/udp",
|
||||
"-v ${env.WORKSPACE}/ci/mailserver/config.json:/config.json"].join(' '),
|
||||
['--store=true',
|
||||
'--keep-alive=true',
|
||||
'--rpc-address=0.0.0.0',
|
||||
'--nat=none'].join(' ')
|
||||
)
|
||||
env.TEST_PEER_ENR = getPeerAddress()
|
||||
} } }
|
||||
}
|
||||
stage('Nim-Waku') {
|
||||
steps { script {
|
||||
nimwaku = docker.image(
|
||||
'statusteam/nim-waku:v0.13.0'
|
||||
).run(
|
||||
["-p 127.0.0.1:${env.RPC_PORT}:8545",
|
||||
"-p 127.0.0.1:${env.P2P_PORT}:30303/tcp",
|
||||
"-p 127.0.0.1:${env.P2P_PORT}:30303/udp",
|
||||
"-v ${env.WORKSPACE}/ci/mailserver/config.json:/config.json"].join(' '),
|
||||
['--store=true',
|
||||
'--keep-alive=true',
|
||||
'--rpc-address=0.0.0.0',
|
||||
'--nat=none'].join(' ')
|
||||
)
|
||||
env.TEST_PEER_ENR = getPeerAddress()
|
||||
} }
|
||||
}
|
||||
|
||||
stage('Tests') {
|
||||
|
@ -169,10 +149,7 @@ pipeline {
|
|||
} }
|
||||
} }
|
||||
post {
|
||||
failure { script {
|
||||
sh("docker logs ${nimwaku.id}")
|
||||
sh("docker logs ${ganache.id}")
|
||||
} }
|
||||
failure { script { sh("docker logs ${nimwaku.id}") } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +166,6 @@ pipeline {
|
|||
} }
|
||||
cleanup { script {
|
||||
sh './scripts/clean-git.sh'
|
||||
if (binding.hasVariable('ganache')) { ganache.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* = %* {
|
||||
"BrowsersConfig": {
|
||||
"Enabled": true
|
||||
|
|
|
@ -37,7 +37,6 @@ let
|
|||
# runtime variables
|
||||
TEST_MODE_ENABLED* = desktopConfig.testMode
|
||||
WALLET_ENABLED* = desktopConfig.enableWallet
|
||||
GANACHE_NETWORK_RPC_URL* = desktopConfig.genacheNetworkRpcUrl
|
||||
TORRENT_CONFIG_PORT* = desktopConfig.defaultTorentConfigPort
|
||||
WAKU_V2_PORT* = desktopConfig.defaultWakuV2Port
|
||||
STATUS_PORT* = desktopConfig.statusPort
|
||||
|
@ -54,4 +53,4 @@ let
|
|||
ALCHEMY_OPTIMISM_MAINNET_TOKEN_RESOLVED* = desktopConfig.alchemyOptimismMainnetToken
|
||||
ALCHEMY_OPTIMISM_GOERLI_TOKEN_RESOLVED* = desktopConfig.alchemyOptimismGoerliToken
|
||||
OPENSEA_API_KEY_RESOLVED* = desktopConfig.openseaApiKey
|
||||
WALLET_CONNECT_PROJECT_ID* = BUILD_WALLET_CONNECT_PROJECT_ID
|
||||
WALLET_CONNECT_PROJECT_ID* = BUILD_WALLET_CONNECT_PROJECT_ID
|
||||
|
|
|
@ -143,11 +143,6 @@ type StatusDesktopConfig = object
|
|||
desc: "Determines if the wallet section is enabled"
|
||||
name: "ENABLE_WALLET"
|
||||
abbr: "enable-wallet" .}: bool
|
||||
genacheNetworkRpcUrl* {.
|
||||
defaultValue: ""
|
||||
desc: "Sets ganache network rpc url"
|
||||
name: "GANACHE_NETWORK_RPC_URL"
|
||||
abbr: "ganache-network-rpc-url" .}: string
|
||||
defaultTorentConfigPort* {.
|
||||
defaultValue: 0
|
||||
desc: "Sets default torrent config port"
|
||||
|
|
|
@ -356,7 +356,6 @@ TEST(WalletApi, TestGetTokensBalancesForChainIDs_WatchOnlyAccount)
|
|||
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)
|
||||
{
|
||||
ScopedTestAccount testAccount(test_info_->name());
|
||||
|
@ -399,7 +398,6 @@ TEST(WalletApi, TestCheckRecentHistory)
|
|||
ASSERT_TRUE(historyReady);
|
||||
}
|
||||
|
||||
// TODO: this is a debugging test. Augment it with local Ganache environment to have a reliable integration test
|
||||
TEST(WalletApi, TestGetBalanceHistory)
|
||||
{
|
||||
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)
|
||||
{
|
||||
ScopedTestAccount testAccount(test_info_->name());
|
||||
|
@ -589,7 +586,6 @@ TEST(WalletApi, TestStartWallet)
|
|||
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)
|
||||
{
|
||||
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