From a141d154b7cf4efa8d96a08cfc7c9f2aec9f24ee Mon Sep 17 00:00:00 2001 From: nabarun Date: Thu, 5 May 2022 11:33:10 +0530 Subject: [PATCH] Remove dapptools and update test readme to use stack-orchestrator --- Makefile | 8 -- README.md | 4 +- docker-compose.test.yml | 6 +- docker-compose.yml | 18 --- scripts/run_integration_test.sh | 9 -- .../run_integration_test_forward_eth_calls.sh | 9 -- ...gration_test_watched_address_gap_filler.sh | 9 -- scripts/run_unit_test.sh | 5 +- test/README.md | 121 ++++++++++++++++-- 9 files changed, 117 insertions(+), 72 deletions(-) diff --git a/Makefile b/Makefile index c452ad51..c128ff6a 100644 --- a/Makefile +++ b/Makefile @@ -71,14 +71,6 @@ test_local: | $(GINKGO) $(GOOSE) go fmt ./... ./scripts/run_unit_test.sh -.PHONY: integrationtest_local -integrationtest_local: | $(GINKGO) $(GOOSE) - go vet ./... - go fmt ./... - ./scripts/run_integration_test.sh - ./scripts/run_integration_test_forward_eth_calls.sh - ./scripts/run_integration_test_watched_address_gap_filler.sh - build: go fmt ./... GO111MODULE=on go build diff --git a/README.md b/README.md index 1ecf32a4..c99d495f 100644 --- a/README.md +++ b/README.md @@ -148,8 +148,8 @@ TODO: Add the rest of the standard endpoints and unique endpoints (e.g. getSlice ### Testing -`make test` will run the unit tests -`make test` setups a clean `vulcanize_testing` db + +Follow steps in [test/README.md](./test/README.md) ## Monitoring diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 6c1a5448..ecdd3e40 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -2,13 +2,11 @@ version: '3.2' services: contract: - depends_on: - - dapptools build: context: ./test/contract args: - ETH_ADDR: "http://dapptools:8545" + ETH_ADDR: "http://go-ethereum:8545" environment: - ETH_ADDR: "http://dapptools:8545" + ETH_ADDR: "http://go-ethereum:8545" ports: - "127.0.0.1:3000:3000" diff --git a/docker-compose.yml b/docker-compose.yml index 4be0803b..132a8d2e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,24 +1,6 @@ version: '3.2' services: - dapptools: - restart: unless-stopped - depends_on: - - ipld-eth-db - image: vulcanize/dapptools:v0.30.0-v1.10.17-statediff-3.2.0 - environment: - DB_USER: vdbm - DB_NAME: vulcanize_testing - DB_HOST: ipld-eth-db - DB_PORT: 5432 - DB_PASSWORD: password - DB_WRITE: $DB_WRITE - DB_TYPE: postgres - DB_DRIVER: sqlx - ports: - - "127.0.0.1:8545:8545" - - "127.0.0.1:8546:8546" - ipld-eth-db: restart: always image: vulcanize/ipld-eth-db:v3.2.0 diff --git a/scripts/run_integration_test.sh b/scripts/run_integration_test.sh index 8548491a..20867cf3 100755 --- a/scripts/run_integration_test.sh +++ b/scripts/run_integration_test.sh @@ -3,19 +3,10 @@ set -o xtrace export ETH_FORWARD_ETH_CALLS=false export DB_WRITE=true -export ETH_HTTP_PATH="dapptools:8545" export ETH_PROXY_ON_ERROR=false export WATCHED_ADDRESS_GAP_FILLER_ENABLED=false export WATCHED_ADDRESS_GAP_FILLER_INTERVAL=5 -# Clear up existing docker images and volume. -docker-compose down --remove-orphans --volumes - -# Build and start the containers. -# Note: Build only if `ipld-eth-server` or other container code is modified. Otherwise comment this line. -docker-compose -f docker-compose.test.yml -f docker-compose.yml build eth-server -docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server - export PGPASSWORD=password export DATABASE_USER=vdbm export DATABASE_PORT=8077 diff --git a/scripts/run_integration_test_forward_eth_calls.sh b/scripts/run_integration_test_forward_eth_calls.sh index 882c887b..6ef9c068 100755 --- a/scripts/run_integration_test_forward_eth_calls.sh +++ b/scripts/run_integration_test_forward_eth_calls.sh @@ -3,19 +3,10 @@ set -o xtrace export ETH_FORWARD_ETH_CALLS=true export DB_WRITE=false -export ETH_HTTP_PATH="dapptools:8545" export ETH_PROXY_ON_ERROR=false export WATCHED_ADDRESS_GAP_FILLER_ENABLED=false export WATCHED_ADDRESS_GAP_FILLER_INTERVAL=5 -# Clear up existing docker images and volume. -docker-compose down --remove-orphans --volumes - -# Build and start the containers. -# Note: Build only if `ipld-eth-server` or other container code is modified. Otherwise comment this line. -docker-compose -f docker-compose.test.yml -f docker-compose.yml build eth-server -docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server - export PGPASSWORD=password export DATABASE_USER=vdbm export DATABASE_PORT=8077 diff --git a/scripts/run_integration_test_watched_address_gap_filler.sh b/scripts/run_integration_test_watched_address_gap_filler.sh index 1e436098..3b472cd5 100755 --- a/scripts/run_integration_test_watched_address_gap_filler.sh +++ b/scripts/run_integration_test_watched_address_gap_filler.sh @@ -3,19 +3,10 @@ set -o xtrace export ETH_FORWARD_ETH_CALLS=false export DB_WRITE=true -export ETH_HTTP_PATH="dapptools:8545" export ETH_PROXY_ON_ERROR=false export WATCHED_ADDRESS_GAP_FILLER_ENABLED=true export WATCHED_ADDRESS_GAP_FILLER_INTERVAL=5 -# Clear up existing docker images and volume. -docker-compose down --remove-orphans --volumes - -# Build and start the containers. -# Note: Build only if `ipld-eth-server` or other container code is modified. Otherwise comment this line. -docker-compose -f docker-compose.test.yml -f docker-compose.yml build eth-server -docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server - export PGPASSWORD=password export DATABASE_USER=vdbm export DATABASE_PORT=8077 diff --git a/scripts/run_unit_test.sh b/scripts/run_unit_test.sh index bcbeced7..bf9db9d9 100755 --- a/scripts/run_unit_test.sh +++ b/scripts/run_unit_test.sh @@ -2,4 +2,7 @@ docker-compose down --remove-orphans --volumes docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db -PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test \ No newline at end of file +sleep 10 +PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test + +docker-compose down --remove-orphans --volumes diff --git a/test/README.md b/test/README.md index 7d5c3b82..c740b286 100644 --- a/test/README.md +++ b/test/README.md @@ -1,15 +1,112 @@ +# Test Insructions -Spin up services: -``` -docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d db dapptools contract eth-server -``` +## Setup -Running unit tests: -```bash -make test_local -``` +- Clone [stack-orchestrator](https://github.com/vulcanize/stack-orchestrator) and [go-ethereum](https://github.com/vulcanize/go-ethereum) repositories. -Running integration test: -```bash -make integrationtest_local -``` \ No newline at end of file +- Checkout [v3 release](https://github.com/vulcanize/go-ethereum/releases/tag/v1.10.17-statediff-3.2.0) in go-ethereum repo. + ```bash + # In go-ethereum repo. + git checkout v1.10.17-statediff-3.2.0 + ``` + +- Checkout working commit in stack-orchestrator repo. + ```bash + # In stack-orchestrator repo. + git checkout fcbc74451c5494664fe21f765e89c9c6565c07cb + ``` + +## Run + +- Run unit tests: + + ```bash + # In ipld-eth-server root directory. + ./scripts/run_unit_test.sh + ``` + +- Run integration tests: + + - Update (Replace existing content) config file [config.sh](https://github.com/vulcanize/stack-orchestrator/blob/main/config.sh) in stack-orchestrator repo: + ```bash + #!/bin/bash + + # Path to go-ethereum repo. + vulcanize_go_ethereum=~/go-ethereum/ + + # Path to ipld-eth-server repo. + vulcanize_ipld_eth_server=~/ipld-eth-server/ + + db_write=true + eth_forward_eth_calls=false + eth_proxy_on_error=false + eth_http_path="go-ethereum:8545" + ``` + + - Run stack-orchestrator: + ```bash + # In stack-orchestrator root directory. + cd helper-scripts + + ./wrapper.sh \ + -e docker \ + -d ../docker/latest/docker-compose-db.yml \ + -d ../docker/local/docker-compose-go-ethereum.yml \ + -d ../docker/local/docker-compose-ipld-eth-server.yml \ + -v remove \ + -p ../config.sh + ``` + + - Run test: + ```bash + # In ipld-eth-server root directory. + ./scripts/run_integration_test.sh + ``` + + - Update `config.sh` file: + ```bash + #!/bin/bash + + # Path to go-ethereum repo. + vulcanize_go_ethereum=~/go-ethereum/ + + # Path to ipld-eth-server repo. + vulcanize_ipld_eth_server=~/ipld-eth-server/ + + db_write=false + eth_forward_eth_calls=true + eth_proxy_on_error=false + eth_http_path="go-ethereum:8545" + ``` + + - Stop the stack-orchestrator and start again using the same command + + - Run integration tests for direct proxy fall-through of eth_calls: + ```bash + ./scripts/run_integration_test_forward_eth_calls.sh + ``` + + - Update `config.sh` file: + ```bash + #!/bin/bash + + # Path to go-ethereum repo. + vulcanize_go_ethereum=~/go-ethereum/ + + # Path to ipld-eth-server repo. + vulcanize_ipld_eth_server=~/ipld-eth-server/ + + db_write=true + eth_forward_eth_calls=false + eth_proxy_on_error=false + eth_http_path="go-ethereum:8545" + watched_addres_gap_filler_enabled=true + watched_addres_gap_filler_interval=5 + ``` + + - Stop the stack-orchestrator and start again using the same command + + - Run integration tests for watched addresses with gap filling service enabled: + ```bash + ./scripts/run_integration_test_watched_address_gap_filler.sh + ```