chore: setup a mailserver as part of UI tests run in CI
This commit is contained in:
parent
71454e0e3d
commit
1a2524cbda
|
@ -22,7 +22,7 @@ pipeline {
|
|||
options {
|
||||
timestamps()
|
||||
/* Prevent Jenkins jobs from running forever */
|
||||
timeout(time: 60, unit: 'MINUTES')
|
||||
timeout(time: 120, unit: 'MINUTES')
|
||||
/* manage how many builds we keep */
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
|
@ -84,23 +84,30 @@ pipeline {
|
|||
def goerli_rpc_port = 855 + env.EXECUTOR_NUMBER
|
||||
def mnemonic = "pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial"
|
||||
def goerli_db_path = "$WORKSPACE/test/ui-test/fixtures/ganache-dbs/goerli"
|
||||
def rpc_port = 864 + env.EXECUTOR_NUMBER
|
||||
def geth_port = 3131 + env.EXECUTOR_NUMBER
|
||||
docker.image('trufflesuite/ganache:v7.4.1').withRun(
|
||||
"-p 127.0.0.1:${goerli_rpc_port}:8545 -v ${goerli_db_path}:/goerli-db",
|
||||
"-e 10 -m='${mnemonic}' --chain.chainId 5 --database.dbPath /goerli-db"
|
||||
) { c ->
|
||||
sh "docker logs ${c.id}"
|
||||
withEnv(["GOERLI_NETWORK_RPC_URL=http://0.0.0.0:${goerli_rpc_port}"]){
|
||||
wrap([
|
||||
$class: 'Xvfb',
|
||||
autoDisplayName: true,
|
||||
parallelBuild: true,
|
||||
screen: '2560x1440x24',
|
||||
]) {
|
||||
script {
|
||||
def res = squish([
|
||||
extraOptions: '''
|
||||
--retry
|
||||
2
|
||||
docker.image('statusteam/status-go:v0.84.0').withRun(
|
||||
"-p 127.0.0.1:${rpc_port}:8545 -p 127.0.0.1:${geth_port}:30303/tcp -p 127.0.0.1:${geth_port}:30303/udp -v ${env.WORKSPACE}/ci/mailserver/config.json:/config.json",
|
||||
"-log=INFO -log-without-color -c=/config.json -dir=/tmp"
|
||||
) { c2 ->
|
||||
env.PEER_ENR = sh(script:"RPC_PORT=${rpc_port} MAILSERVER_PORT=${geth_port} ${env.WORKSPACE}/ci/mailserver/get_enode.sh", returnStdout:true).trim()
|
||||
withEnv(["TEST_PEER_ENR=${env.PEER_ENR}", "GOERLI_NETWORK_RPC_URL=http://0.0.0.0:${goerli_rpc_port}"]){
|
||||
wrap([
|
||||
$class: 'Xvfb',
|
||||
autoDisplayName: true,
|
||||
parallelBuild: true,
|
||||
screen: '2560x1440x24',
|
||||
]) {
|
||||
script {
|
||||
def res = squish([
|
||||
extraOptions: '''
|
||||
--retry
|
||||
2
|
||||
|
||||
--tags
|
||||
~mayfail
|
||||
|
@ -115,11 +122,12 @@ pipeline {
|
|||
''',
|
||||
squishPackageName: 'squish-6.7.2-qt514x-linux64',
|
||||
testSuite: '${WORKSPACE}/test/ui-test/testSuites/*',
|
||||
])
|
||||
if ( res == "SUCCESS" || res == "UNSTABLE" ) {
|
||||
return
|
||||
])
|
||||
if ( res == "SUCCESS" || res == "UNSTABLE" ) {
|
||||
return
|
||||
}
|
||||
throw new Exception("squish test didn't end with success")
|
||||
}
|
||||
throw new Exception("squish test didn't end with success")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"Rendezvous": false,
|
||||
"NoDiscovery": true,
|
||||
"ClusterConfig": {
|
||||
"Enabled": true,
|
||||
"Fleet": "eth.prod",
|
||||
"BootNodes": [],
|
||||
"TrustedMailServers": [],
|
||||
"PushNotificationsServers": [],
|
||||
"StaticNodes": []
|
||||
},
|
||||
"ListenAddr": "0.0.0.0:30303",
|
||||
"HTTPEnabled": true,
|
||||
"HTTPHost": "0.0.0.0",
|
||||
"HTTPPort": 8545,
|
||||
"MaxPeers": 50,
|
||||
"DataDir": "/var/tmp/status-go-mailserver",
|
||||
"APIModules": "eth,web3,admin,waku,wakuext",
|
||||
"RegisterTopics": [
|
||||
"whispermail"
|
||||
],
|
||||
"WakuConfig": {
|
||||
"Enabled": true,
|
||||
"EnableMailServer": true,
|
||||
"DataDir": "/var/tmp/status-go-mailserver/waku",
|
||||
"MailServerPassword": "status-offline-inbox",
|
||||
"MailServerDataRetention": 30
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
RPC_ADDR="${RPC_ADDR:-localhost}"
|
||||
RPC_PORT="${RPC_PORT:-8545}"
|
||||
MAILSERVER_PORT="${MAILSERVER_PORT:-30303}"
|
||||
# might be provided by parent
|
||||
if [[ -z "${PUBLIC_IP}" ]]; then
|
||||
PUBLIC_IP=$(curl -s https://ipecho.net/plain)
|
||||
fi
|
||||
|
||||
# query local
|
||||
RESP_JSON=$(
|
||||
curl -sS --retry 3 --retry-connrefused \
|
||||
-X POST http://${RPC_ADDR}:${RPC_PORT}/ \
|
||||
-H 'Content-type: application/json' \
|
||||
-d '{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":1}'
|
||||
)
|
||||
if [[ "$?" -ne 0 ]]; then
|
||||
echo "RPC port not up, unable to query enode address!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# extract enode from JSON response
|
||||
ENODE_RAW=$(echo "${RESP_JSON}" | jq -r '.result.enode')
|
||||
# drop arguments at the end of enode address
|
||||
ENODE_CLEAN=$(echo "${ENODE_RAW}" | grep -oP '\Kenode://[^?]+')
|
||||
|
||||
ENODE=$(echo "${ENODE_CLEAN}" | sed \
|
||||
-e "s/:30303/:${MAILSERVER_PORT}/")
|
||||
|
||||
echo "${ENODE}"
|
|
@ -46,7 +46,7 @@ proc pinMailserver*(self: Controller, nodeAddress: string) =
|
|||
discard self.settingsService.pinMailserver(nodeAddress, fleet)
|
||||
|
||||
proc saveNewMailserver*(self: Controller, name: string, nodeAddress: string) =
|
||||
self.mailserversService.saveMailserver(name, nodeAddress)
|
||||
discard self.mailserversService.saveMailserver(name, nodeAddress)
|
||||
|
||||
proc enableAutomaticSelection*(self: Controller, value: bool) =
|
||||
self.mailserversService.enableAutomaticSelection(value)
|
||||
|
|
|
@ -24,6 +24,10 @@ const ACCOUNT_ALREADY_EXISTS_ERROR = "account already exists"
|
|||
const output_csv {.booldefine.} = false
|
||||
const KDF_ITERATIONS* {.intdefine.} = 256_000
|
||||
|
||||
# allow runtime override via environment variable. core contributors can set a
|
||||
# specific peer to set for testing messaging and mailserver functionality with squish.
|
||||
let TEST_PEER_ENR = getEnv("TEST_PEER_ENR").string
|
||||
|
||||
include utils
|
||||
|
||||
|
||||
|
@ -286,6 +290,14 @@ proc getDefaultNodeConfig*(self: Service, installationId: string): JsonNode =
|
|||
result["ClusterConfig"]["FilterNodes"] = %* self.fleetConfiguration.getNodes(fleet, FleetNodes.Waku)
|
||||
result["ClusterConfig"]["LightpushNodes"] = %* self.fleetConfiguration.getNodes(fleet, FleetNodes.Waku)
|
||||
|
||||
if TEST_PEER_ENR != "":
|
||||
result["ClusterConfig"]["BootNodes"] = %* @[TEST_PEER_ENR]
|
||||
result["ClusterConfig"]["TrustedMailServers"] = %* @[TEST_PEER_ENR]
|
||||
result["ClusterConfig"]["StaticNodes"] = %* @[TEST_PEER_ENR]
|
||||
result["ClusterConfig"]["RendezvousNodes"] = %* (@[])
|
||||
result["ClusterConfig"]["DiscV5BootstrapNodes"] = %* (@[])
|
||||
result["Rendezvous"] = newJBool(false)
|
||||
|
||||
result["KeyStoreDir"] = newJString(self.keyStoreDir.replace(main_constants.STATUSGODIR, ""))
|
||||
|
||||
proc setLocalAccountSettingsFile(self: Service) =
|
||||
|
@ -531,6 +543,16 @@ proc login*(self: Service, account: AccountDto, password: string): string =
|
|||
"UDPPort": wV2Port,
|
||||
})
|
||||
|
||||
if TEST_PEER_ENR != "":
|
||||
nodeCfg["Rendezvous"] = newJBool(false)
|
||||
nodeCfg["ClusterConfig"] = %* {
|
||||
"BootNodes": @[TEST_PEER_ENR],
|
||||
"TrustedMailServers": @[TEST_PEER_ENR],
|
||||
"StaticNodes": @[TEST_PEER_ENR],
|
||||
"RendezvousNodes": @[],
|
||||
"DiscV5BootstrapNodes": @[]
|
||||
}
|
||||
|
||||
let response = status_account.login(account.name, account.keyUid, account.kdfIterations, hashedPassword, thumbnailImage,
|
||||
largeImage, $nodeCfg)
|
||||
var error = "response doesn't contain \"error\""
|
||||
|
|
|
@ -13,6 +13,10 @@ import ../../../backend/mailservers as status_mailservers
|
|||
# mailserver address in this way for local development or test
|
||||
let MAILSERVER_ADDRESS = $getEnv("MAILSERVER")
|
||||
|
||||
# allow runtime override via environment variable. core contributors can set a
|
||||
# specific peer to set for testing messaging and mailserver functionality with squish.
|
||||
let TEST_PEER_ENR = getEnv("TEST_PEER_ENR").string
|
||||
|
||||
logScope:
|
||||
topics = "mailservers-service"
|
||||
|
||||
|
@ -82,6 +86,7 @@ QtObject:
|
|||
proc doConnect(self: Service)
|
||||
proc initMailservers(self: Service)
|
||||
proc fetchMailservers(self: Service)
|
||||
proc saveMailserver*(self: Service, name: string, nodeAddress: string): string
|
||||
|
||||
proc delete*(self: Service) =
|
||||
self.QObject.delete
|
||||
|
@ -103,8 +108,20 @@ QtObject:
|
|||
self.initMailservers()
|
||||
self.fetchMailservers()
|
||||
|
||||
let fleet = self.settingsService.getFleet()
|
||||
if TEST_PEER_ENR != "":
|
||||
var found = false
|
||||
for mailserver in self.mailservers:
|
||||
if mailserver.nodeAddress == TEST_PEER_ENR:
|
||||
found = true
|
||||
break
|
||||
if not found:
|
||||
let mailserverName = "Test Mailserver"
|
||||
self.mailservers.add((name: mailserverName, nodeAddress: TEST_PEER_ENR))
|
||||
let mailserverID = self.saveMailserver(mailserverName, TEST_PEER_ENR)
|
||||
discard self.settingsService.pinMailserver(mailserverId, fleet)
|
||||
|
||||
if MAILSERVER_ADDRESS != "":
|
||||
let fleet = self.settingsService.getFleet()
|
||||
discard self.settingsService.pinMailserver(MAILSERVER_ADDRESS, fleet)
|
||||
|
||||
proc mailserverSynced*(self: Service, syncInfo: string) {.slot.} =
|
||||
|
@ -194,7 +211,7 @@ QtObject:
|
|||
proc getAllMailservers*(self: Service): seq[tuple[name: string, nodeAddress: string]] =
|
||||
return self.mailservers
|
||||
|
||||
proc saveMailserver*(self: Service, name: string, nodeAddress: string) =
|
||||
proc saveMailserver*(self: Service, name: string, nodeAddress: string): string =
|
||||
try:
|
||||
let fleet = self.settingsService.getFleetAsString()
|
||||
let id = $genUUID()
|
||||
|
@ -204,10 +221,12 @@ QtObject:
|
|||
# once we have more info from `status-go` we may emit a signal from here and
|
||||
# update view or display an error accordingly
|
||||
|
||||
return id
|
||||
|
||||
except Exception as e:
|
||||
let errDesription = e.msg
|
||||
error "error: ", errDesription
|
||||
return
|
||||
return ""
|
||||
|
||||
proc enableAutomaticSelection*(self: Service, value: bool) =
|
||||
if value:
|
||||
|
|
|
@ -8,7 +8,6 @@ Feature: Status Desktop Group Chat
|
|||
When the user tester123 logs in with password TesTEr16843/!@00
|
||||
Then the user lands on the signed in app
|
||||
|
||||
@mayfail
|
||||
Scenario: As an admin user I want to create a group chat with my contacts and the invited users can send messages
|
||||
|
||||
When the user creates a group chat adding users
|
||||
|
|
Loading…
Reference in New Issue