chore: tidy up capsule restart variables (#1800)

* chore: tidy up capsule restart variables

* chore: add flow for manually triggering all tests

* chore: fix if statement

* chore: revert flow change
This commit is contained in:
Joe Tsang 2022-10-20 13:55:12 +01:00 committed by GitHub
parent 61cfac22a1
commit 044eb160af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 10 deletions

View File

@ -49,7 +49,7 @@ jobs:
# See if we capsule is needed for this project
- name: Set capsule flag
if: ${{ github.event.inputs.project == 'explorer-e2e' || github.event.inputs.project == 'token-e2e' }}
if: ${{ github.event.inputs.project == 'explorer-e2e' || github.event.inputs.project == 'token-e2e'}}
run: echo RUN_CAPSULE=true >> $GITHUB_ENV
#######

View File

@ -101,14 +101,14 @@ jobs:
working-directory: frontend-monorepo
- name: Run Cypress tests
run: yarn nx run-many --skip-nx-cache --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
run: yarn nx run-many --skip-nx-cache --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome --parallel=1
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }}
CYPRESS_NIGHTLY_RUN: true
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: false
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
######
## Upload logs

View File

@ -27,7 +27,6 @@ module.exports = defineConfig({
networkQueryUrl: 'http://localhost:3028/query',
ethUrl: 'https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
commitHash: 'dev',
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true,
tsConfig: 'tsconfig.json',
grepTags: '@regression @smoke @slow',
grepFilterSpecs: true,

View File

@ -192,7 +192,7 @@ context('Parties page', { tags: '@regression' }, function () {
after(
'teardown environment to prevent test data bleeding into other tests',
function () {
if (Cypress.env('CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS')) {
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
cy.restart_vegacapsule_network();
}
}

View File

@ -812,7 +812,7 @@ context(
after(
'teardown environment to prevent test data bleeding into other tests',
function () {
if (Cypress.env('CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS')) {
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
cy.restart_vegacapsule_network();
}
}

View File

@ -875,7 +875,7 @@ context(
after(
'teardown environment to prevent test data bleeding into other tests',
function () {
if (Cypress.env('CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS')) {
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
cy.restart_vegacapsule_network();
}
}

View File

@ -314,7 +314,7 @@ context(
after(
'teardown environment to prevent test data bleeding into other tests',
function () {
if (Cypress.env('CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS')) {
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
cy.restart_vegacapsule_network();
}
}

View File

@ -404,7 +404,7 @@ context(
after(
'teardown environment to prevent test data bleeding into other tests',
function () {
if (Cypress.env('CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS')) {
if (Cypress.env('TEARDOWN_NETWORK_AFTER_FLOWS')) {
cy.restart_vegacapsule_network();
}
}

View File

@ -15,12 +15,14 @@ export function addRestartVegacapsuleNetwork() {
// This stops those errors from preventing the teardown
return false;
});
cy.log('Destroying capsule network');
// We stop the network twice - since it does not always shutdown correctly on first attempt
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false });
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false })
.its('stderr')
.should('contain', 'Network has been successfully cleaned up');
cy.log('Bootstrapping network');
cy.exec(
'vegacapsule network bootstrap --config-path=../../vegacapsule/config.hcl --force',
{ failOnNonZeroExit: false, timeout: 100000 }
@ -28,7 +30,10 @@ export function addRestartVegacapsuleNetwork() {
.its('stderr')
.then((response) => {
if (!response.includes('Network successfully started')) {
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false });
cy.log('Bootstrapping network second time');
cy.exec('vegacapsule network destroy', { failOnNonZeroExit: false })
.its('stderr')
.should('contain', 'Network has been successfully cleaned up');
cy.exec(
'vegacapsule network bootstrap --config-path=../../vegacapsule/config.hcl --force',
{ failOnNonZeroExit: false, timeout: 100000 }