116 lines
3.9 KiB
YAML
116 lines
3.9 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches: '*'
|
|
push:
|
|
branches:
|
|
- main
|
|
- ci-test
|
|
workflow_call:
|
|
|
|
env:
|
|
ETH_TESTING_REF: v0.5.2
|
|
|
|
jobs:
|
|
integration-tests:
|
|
name: Run integration tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version-file: go.mod
|
|
check-latest: true
|
|
- name: Run DB container
|
|
run: docker compose -f test/compose.yml up --wait
|
|
|
|
- name: Build package
|
|
run: go build .
|
|
- name: Install test fixtures
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: cerc-io/eth-testing
|
|
path: ./fixtures
|
|
ref: ${{ env.ETH_TESTING_REF }}
|
|
# Run a sanity test against the fixture data
|
|
# Complete integration tests are TODO
|
|
- name: Run basic integration test
|
|
env:
|
|
ETHDB_PATH: ./fixtures/chains/data/premerge2/geth/chaindata
|
|
ETH_CHAIN_CONFIG: ./fixtures/chains/data/premerge2/genesis.config.json
|
|
ETH_GENESIS_BLOCK: 0x8a3c7cddacbd1ab4ec1b03805fa2a287f3a75e43d87f4f987fcc399f5c042614
|
|
LOG_FILE: ./server-log
|
|
timeout-minutes: 20
|
|
run: |
|
|
./eth-statediff-service --config ./test/ci-config.toml serve &
|
|
sleep 10
|
|
|
|
./scripts/request-range.sh 0 10 || (E=$?; cat $LOG_FILE; exit $E)
|
|
|
|
until grep "Finished processing block 10" $LOG_FILE
|
|
do sleep 1; done
|
|
|
|
count_results() {
|
|
query="select count(*) from $1;"
|
|
docker exec -e PGPASSWORD=password test-ipld-eth-db-1 \
|
|
psql -tA cerc_testing -U vdbm -c "$query"
|
|
}
|
|
set -x
|
|
[[ "$(count_results eth.header_cids)" = 11 ]]
|
|
[[ "$(count_results eth.state_cids)" = 287 ]]
|
|
[[ "$(count_results eth.storage_cids)" = 31 ]]
|
|
[[ "$(count_results eth.transaction_cids)" = 144 ]]
|
|
[[ "$(count_results eth.receipt_cids)" = 144 ]]
|
|
|
|
compliance-test:
|
|
name: Run compliance tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
path: ./eth-statediff-service
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version-file: ./eth-statediff-service/go.mod
|
|
check-latest: true
|
|
- name: Build current version
|
|
working-directory: ./eth-statediff-service
|
|
run: go build -o ../service-current .
|
|
|
|
- name: Checkout canonical version
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: ./eth-statediff-service-canonical
|
|
ref: ${{ env.CANONICAL_VERSION }}
|
|
- name: Build canonical version
|
|
working-directory: ./eth-statediff-service-canonical
|
|
run: go build -o ../service-canonical .
|
|
|
|
- name: Install test fixtures
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: cerc-io/eth-testing
|
|
path: ./fixtures
|
|
ref: ${{ env.ETH_TESTING_REF }}
|
|
- name: Run DB container
|
|
working-directory: ./eth-statediff-service
|
|
run: docker compose -f test/compose.yml up --wait
|
|
- name: Compare statediff output
|
|
timeout-minutes: 10
|
|
env:
|
|
ETHDB_PATH: ./fixtures/chains/data/premerge2/geth/chaindata
|
|
ETHDB_ANCIENT: ./fixtures/chains/data/premerge2/geth/chaindata/ancient
|
|
ETH_CHAIN_CONFIG: ./fixtures/chains/data/premerge2/genesis.config.json
|
|
ETH_GENESIS_BLOCK: "0x8a3c7cddacbd1ab4ec1b03805fa2a287f3a75e43d87f4f987fcc399f5c042614"
|
|
run: |
|
|
until
|
|
ready_query='select max(version_id) from goose_db_version;'
|
|
version=$(docker exec -e PGPASSWORD=password test-ipld-eth-db-1 \
|
|
psql -tA cerc_testing -U vdbm -c "$ready_query")
|
|
[[ "$version" -ge 21 ]]
|
|
do sleep 1; done
|
|
|
|
./eth-statediff-service/scripts/compare-statediffs.sh \
|
|
./service-canonical ./service-current
|