From 9c3d8b353e05181d4f314c90a183b3645222e1ed Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 23 Apr 2024 18:45:12 +0800 Subject: [PATCH] update integ tests --- .github/workflows/test.yml | 22 +--------------------- integration/integration_test.go | 4 ++-- scripts/get-block-number.sh | 2 +- scripts/integration-setup.sh | 20 ++++++++++++-------- test/compose-deployer.yml | 2 +- test/stack-refs.txt | 2 -- test/stack.yml | 20 ++++++++++++++++++++ 7 files changed, 37 insertions(+), 35 deletions(-) delete mode 100644 test/stack-refs.txt create mode 100644 test/stack.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30d8eae..99aa211 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,9 +12,7 @@ on: - ci-test env: - # Needed until we can incorporate docker startup into the executor container - DOCKER_HOST: unix:///var/run/dind.sock - SO_VERSION: v1.1.0-e0b5318-202309201927 # contains fixes for plugeth stack + SO_VERSION: v1.1.0-87fffca-202404110321 jobs: unit-tests: @@ -26,18 +24,9 @@ jobs: with: go-version-file: 'go.mod' check-latest: true - - name: Run dockerd - run: | - dockerd -H $DOCKER_HOST --userland-proxy=false & - sleep 5 - name: Run DB container run: | docker compose -f test/compose-db.yml up --wait --quiet-pull - - name: Set access token - env: - TOKEN: ${{ secrets.CICD_REPO_TOKEN }} - run: | - git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/ - name: Run tests run: go test -p 1 -v ./pkg/... @@ -50,15 +39,6 @@ jobs: with: go-version-file: 'go.mod' check-latest: true - - name: Run dockerd - run: | - dockerd -H $DOCKER_HOST --userland-proxy=false & - sleep 5 - - name: Set Gitea access token - env: - TOKEN: ${{ secrets.CICD_REPO_TOKEN }} - run: | - git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/ - name: Install jq env: diff --git a/integration/integration_test.go b/integration/integration_test.go index 2980a58..6d75925 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - helpers "github.com/cerc-io/plugeth-statediff/test_helpers" + "github.com/cerc-io/plugeth-statediff/indexer/database/sql/postgres" "github.com/onsi/gomega" . "github.com/onsi/gomega" @@ -50,7 +50,7 @@ func setup(t *testing.T, progressChan chan uint64) { t.Fatal(err) } // set the default DB config to the testing defaults - cfg.DBConfig, _ = helpers.TestDBConfig.WithEnv() + cfg.DBConfig, _ = postgres.TestConfig.WithEnv() // update the start block if we have already validated past it if lastValidated > cfg.FromBlock { cfg.FromBlock = lastValidated diff --git a/scripts/get-block-number.sh b/scripts/get-block-number.sh index 6065c8a..b388590 100755 --- a/scripts/get-block-number.sh +++ b/scripts/get-block-number.sh @@ -2,7 +2,7 @@ set -eu -geth_endpoint="$1" +geth_endpoint="${1:-$ETH_HTTP_PATH}" latest_block_hex=$(curl -s $geth_endpoint -X POST -H "Content-Type: application/json" \ --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":42}' | \ diff --git a/scripts/integration-setup.sh b/scripts/integration-setup.sh index 8894523..39ee8bb 100755 --- a/scripts/integration-setup.sh +++ b/scripts/integration-setup.sh @@ -4,24 +4,28 @@ set -e +laconic_so="${LACONIC_SO:-laconic-so} --stack $(readlink -f test) --verbose" + CONFIG_DIR=$(readlink -f "${CONFIG_DIR:-$(mktemp -d)}") +# Prevent conflicting tty output +export BUILDKIT_PROGRESS=plain + # Point stack-orchestrator to the multi-project root export CERC_REPO_BASE_DIR="${CERC_REPO_BASE_DIR:-..}" -# v5 migrations only go up to version 18 -echo CERC_STATEDIFF_DB_GOOSE_MIN_VER=18 >> $CONFIG_DIR/stack.env - -laconic_so="${LACONIC_SO:-laconic-so} --stack fixturenet-plugeth-tx --verbose" +# v5 migrations only go up to version 20 +echo CERC_STATEDIFF_DB_GOOSE_MIN_VER=20 >> $CONFIG_DIR/stack.env +# don't run plugeth in the debugger +echo CERC_REMOTE_DEBUG=false >> $CONFIG_DIR/stack.env set -x if [[ -z $SKIP_BUILD ]]; then $laconic_so setup-repositories \ - --exclude github.com/cerc-io/ipld-eth-server,github.com/cerc-io/tx-spammer,github.com/dboreham/foundry \ - --branches-file ./test/stack-refs.txt - + --exclude git.vdb.to/cerc-io/ipld-eth-server + # Assume the tested image has been built separately $laconic_so build-containers \ - --exclude cerc/ipld-eth-server,cerc/keycloak,cerc/tx-spammer,cerc/foundry + --exclude cerc/ipld-eth-server fi $laconic_so deploy \ diff --git a/test/compose-deployer.yml b/test/compose-deployer.yml index 8aa26f0..c1f4733 100644 --- a/test/compose-deployer.yml +++ b/test/compose-deployer.yml @@ -3,7 +3,7 @@ services: contract-deployer: restart: on-failure - image: cerc/ipld-eth-db-validator/contract-deployer:local + image: cerc/ipld-eth-db-validator/test-contract-deployer:local build: ./contract networks: - test_default diff --git a/test/stack-refs.txt b/test/stack-refs.txt deleted file mode 100644 index fe45d4e..0000000 --- a/test/stack-refs.txt +++ /dev/null @@ -1,2 +0,0 @@ -github.com/cerc-io/ipld-eth-db v5.0.5-alpha -git.vdb.to/cerc-io/plugeth-statediff v0.1.1 diff --git a/test/stack.yml b/test/stack.yml new file mode 100644 index 0000000..d1a3ea0 --- /dev/null +++ b/test/stack.yml @@ -0,0 +1,20 @@ +version: "1.2" +name: fixturenet-plugeth-tx +description: "Plugeth Ethereum Fixturenet for testing ipld-eth-db-validator" +repos: + - git.vdb.to/cerc-io/plugeth@statediff-patches # todo: dev + - git.vdb.to/cerc-io/plugeth-statediff@update-czkg4844 # todo: dev + - git.vdb.to/cerc-io/lighthouse + - git.vdb.to/cerc-io/ipld-eth-db@v5.2.1-alpha +containers: + - cerc/plugeth-statediff + - cerc/plugeth + - cerc/fixturenet-eth-genesis + - cerc/fixturenet-plugeth-plugeth + - cerc/lighthouse + - cerc/lighthouse-cli + - cerc/fixturenet-eth-lighthouse + - cerc/ipld-eth-db +pods: + - fixturenet-plugeth + - ipld-eth-db