Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add e2e consensus test #3126

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
outputs:
DEFAULT_TESTS: ${{ steps.matrix-conditionals.outputs.DEFAULT_TESTS }}
UPGRADE_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_TESTS }}
CONSENSUS_TESTS: ${{ steps.matrix-conditionals.outputs.CONSENSUS_TESTS }}
UPGRADE_LIGHT_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_LIGHT_TESTS }}
UPGRADE_IMPORT_MAINNET_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_IMPORT_MAINNET_TESTS }}
ADMIN_TESTS: ${{ steps.matrix-conditionals.outputs.ADMIN_TESTS }}
Expand All @@ -128,16 +129,22 @@ jobs:
uses: actions/github-script@v7
with:
script: |
if (context.eventName === 'pull_request') {
const getPrLabels = async (pull_number) => {
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
const labels = pr.labels.map(label => label.name);
console.log("labels:", labels);
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull_number,
});
const labels = pr.labels.map(label => label.name);
console.log(`labels for ${pull_number}:`, labels);
return labels;
}

if (context.eventName === 'pull_request') {
const labels = await getPrLabels(context.payload.pull_request.number);
core.setOutput('DEFAULT_TESTS', true);
core.setOutput('UPGRADE_TESTS', labels.includes('UPGRADE_TESTS'));
core.setOutput('CONSENSUS_TESTS', labels.includes('CONSENSUS_TESTS'));
core.setOutput('UPGRADE_LIGHT_TESTS', labels.includes('UPGRADE_LIGHT_TESTS'));
core.setOutput('UPGRADE_IMPORT_MAINNET_TESTS', labels.includes('UPGRADE_IMPORT_MAINNET_TESTS'));
core.setOutput('ADMIN_TESTS', labels.includes('ADMIN_TESTS'));
Expand All @@ -150,8 +157,20 @@ jobs:
core.setOutput('V2_MIGRATION_TESTS', labels.includes('V2_MIGRATION_TESTS')); // for v2 tests, TODO: remove this once we fully migrate to v2 (https://github.com/zeta-chain/node/issues/2627)
core.setOutput('ENABLE_MONITORING', labels.includes('ENABLE_MONITORING'));
} else if (context.eventName === 'merge_group') {
// default mergequeue tests
core.setOutput('DEFAULT_TESTS', true);
core.setOutput('UPGRADE_LIGHT_TESTS', true);

// conditional tests based on PR labels
const commit_message = context.payload.merge_group.head_commit.message;
const pr_match = commit_message.split('\n')[0].match(/\(#(\d+)\)$/);
if (!pr_match) {
console.error("unable to extract PR number from mergequeue commit message");
return;
}
const pr_number = pr_match[1];
const pr_labels = getPrLabels(pr_number);
core.setOutput('CONSENSUS_TESTS', !labels.includes('CONSENSUS_BREAKING_ACK'));
gartnera marked this conversation as resolved.
Show resolved Hide resolved
} else if (context.eventName === 'push' && context.ref === 'refs/heads/develop') {
core.setOutput('DEFAULT_TESTS', true);
} else if (context.eventName === 'push' && context.ref.startsWith('refs/heads/release/')) {
Expand Down Expand Up @@ -206,6 +225,9 @@ jobs:
- make-target: "start-e2e-test"
runs-on: ubuntu-20.04
run: ${{ needs.matrix-conditionals.outputs.DEFAULT_TESTS == 'true' }}
- make-target: "start-e2e-consensus-test"
runs-on: ubuntu-20.04
run: ${{ needs.matrix-conditionals.outputs.CONSENSUS_TESTS == 'true' }}
- make-target: "start-upgrade-test"
runs-on: ubuntu-20.04
run: ${{ needs.matrix-conditionals.outputs.UPGRADE_TESTS == 'true' }}
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ solana:

start-e2e-test: e2e-images
@echo "--> Starting e2e test"
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d

start-e2e-admin-test: e2e-images
@echo "--> Starting e2e admin test"
Expand All @@ -286,6 +286,12 @@ start-e2e-import-mainnet-test: e2e-images
export ZETACORED_START_PERIOD=15m && \
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) up -d

start-e2e-consensus-test: e2e-images
lumtis marked this conversation as resolved.
Show resolved Hide resolved
@echo "--> Starting e2e consensus test"
export ZETACORE1_IMAGE=ghcr.io/zeta-chain/zetanode:develop && \
export ZETACORE1_PLATFORM=linux/amd64 && \
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d

start-stress-test: e2e-images
@echo "--> Starting stress test"
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress up -d
Expand Down
3 changes: 2 additions & 1 deletion contrib/localnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ services:
- ~/.zetacored/genesis_data:/root/genesis_data

zetacore1:
image: zetanode:latest
image: ${ZETACORE1_IMAGE-zetanode:latest}
platform: ${ZETACORE1_PLATFORM-}
container_name: zetacore1
hostname: zetacore1
networks:
Expand Down
Loading