Skip to content

Migration Testing

Migration Testing #44

name: Migration Testing
on:
workflow_dispatch:
inputs:
initialNetworkNodeTag:
description: 'Specify initial Network Node image tag'
required: true
default: ''
initialMirrorNodeTag:
description: 'Specify initial Mirror-Node image tag'
required: true
default: ''
initialRelayTag:
description: 'Specify initial Hedera JSON-RPC Relay tag'
required: true
default: ''
targetNetworkNodeTag:
description: 'Specify target Network Node image tag'
required: true
default: ''
targetMirrorNodeTag:
description: 'Specify target Mirror-Node image tag'
required: true
default: ''
targetRelayTag:
description: 'Specify target Hedera JSON-RPC Relay tag'
required: true
default: ''
preMigrationTestTags:
description: 'Specify pre-migration test tags'
required: false
default: '@pre-migration'
postMigrationTestTags:
description: 'Specify post-migration test tags'
required: false
default: '@post-migration'
jobs:
check:
name:
Migration testing (${{ inputs.preMigrationTestTags }}/${{ inputs.postMigrationTestTags }}) with initial N:${{ inputs.initialNetworkNodeTag }}, M:${{ inputs.initialMirrorNodeTag }}, R:${{ inputs.initialRelayTag }} and
target N:${{ inputs.targetNetworkNodeTag }}, M:${{ inputs.targetMirrorNodeTag }}, R:${{ inputs.targetRelayTag }}
runs-on: [self-hosted, Linux, large, ephemeral]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Use Node.js [18.15]
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 18.15
cache: npm
- name: Create .env file
run: cp local.env .env
- name: Install dependencies
run: npm install
- name: Update @hashgraph/hedera-local
run: npm install @hashgraph/hedera-local --save
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@8f1998e9878d786675189ef566a2e4bf24869773 # v1.2.0
with:
version: nightly
- name: Start the local node with N:${{ inputs.initialNetworkNodeTag }}, M:${{ inputs.initialMirrorNodeTag }}, R:${{ inputs.initialRelayTag }}
run: npx hedera start -d --full --network-tag=${{inputs.initialNetworkNodeTag}} --mirror-tag=${{inputs.initialMirrorNodeTag}} --relay-tag=${{inputs.initialRelayTag}}
timeout-minutes: 5
- name: Run pre-migration tests
run: npx hardhat test --grep ${{ inputs.preMigrationTestTags }}
timeout-minutes: 15
- name: Freeze the network
run: |
npx hardhat run scripts/freeze-network-node.js
sleep 30
timeout-minutes: 5
- name: Stop docker containers (network node)
run: docker stop network-node json-rpc-relay json-rpc-relay-ws
timeout-minutes: 5
- name: Run the local node with N:${{ inputs.targetNetworkNodeTag }}, M:${{ inputs.targetMirrorNodeTag }}, R:${{ inputs.targetRelayTag }}
env:
NETWORK_NODE_IMAGE_TAG: ${{inputs.targetNetworkNodeTag}}
MIRROR_IMAGE_TAG: ${{inputs.targetMirrorNodeTag}}
RELAY_IMAGE_TAG: ${{inputs.targetRelayTag}}
NETWORK_NODE_LOGS_ROOT_PATH: ~/.local/share/hedera-local/network-logs/node
run: |
docker compose -f docker-compose-state-migration.yml up -d
sleep 5
working-directory: node_modules/@hashgraph/hedera-local/
timeout-minutes: 5
- name: Run post-migration tests
run: npx hardhat test --grep ${{ inputs.postMigrationTestTags }}
timeout-minutes: 15