From a56da1782a9d372d70bd61ee4e4cb5dad6b1af6a Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Mon, 23 May 2022 19:43:09 +0530 Subject: [PATCH] Update instructions to run tests --- docker-compose.yml | 22 +++++++++++++++++----- scripts/run_integration_test.sh | 2 ++ scripts/run_unit_test.sh | 12 ++++++++++-- test/README.md | 8 ++++---- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e284ce8..628519b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,30 @@ version: '3.2' services: + migrations: + restart: on-failure + depends_on: + - ipld-eth-db + image: vulcanize/ipld-eth-db:v4.1.1-alpha + environment: + DATABASE_USER: "vdbm" + DATABASE_NAME: "vulcanize_testing" + DATABASE_PASSWORD: "password" + DATABASE_HOSTNAME: "ipld-eth-db" + DATABASE_PORT: 5432 + ipld-eth-db: + image: timescale/timescaledb:latest-pg14 restart: always - image: vulcanize/ipld-eth-db:v3.2.0 + command: ["postgres", "-c", "log_statement=all"] environment: POSTGRES_USER: "vdbm" POSTGRES_DB: "vulcanize_testing" POSTGRES_PASSWORD: "password" - volumes: - - vdb_db_eth_validator:/var/lib/postgresql/data ports: - "127.0.0.1:8077:5432" - command: ["postgres", "-c", "log_statement=all"] + volumes: + - vdb_db_eth_validator:/var/lib/postgresql/data volumes: - vdb_db_eth_validator: \ No newline at end of file + vdb_db_eth_validator: diff --git a/scripts/run_integration_test.sh b/scripts/run_integration_test.sh index c9aaa1c..052e7f2 100755 --- a/scripts/run_integration_test.sh +++ b/scripts/run_integration_test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -e set -o xtrace diff --git a/scripts/run_unit_test.sh b/scripts/run_unit_test.sh index 567f4dd..74d586e 100755 --- a/scripts/run_unit_test.sh +++ b/scripts/run_unit_test.sh @@ -1,9 +1,17 @@ +#!/bin/bash + +set -e + # Clear up existing docker images and volume. docker-compose down --remove-orphans --volumes -docker-compose -f docker-compose.yml up -d ipld-eth-db -sleep 10 +# Spin up TimescaleDB +docker-compose -f docker-compose.yml up -d migrations ipld-eth-db +sleep 45 +# Run unit tests +go clean -testcache PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test +# Clean up docker-compose down --remove-orphans --volumes diff --git a/test/README.md b/test/README.md index 0f8b5ad..508500a 100644 --- a/test/README.md +++ b/test/README.md @@ -1,4 +1,4 @@ -# Test Insructions +# Test Instructions ## Setup @@ -6,18 +6,18 @@ - Clone [stack-orchestrator](https://github.com/vulcanize/stack-orchestrator) and [go-ethereum](https://github.com/vulcanize/go-ethereum) repositories. - - Checkout [v3 release](https://github.com/vulcanize/go-ethereum/releases/tag/v1.10.17-statediff-3.2.1) in go-ethereum repo. + - Checkout [v4 release](https://github.com/vulcanize/go-ethereum/releases/tag/v1.10.17-statediff-4.0.1-alpha) in go-ethereum repo. ```bash # In go-ethereum repo. - git checkout v1.10.17-statediff-3.2.1 + git checkout v1.10.17-statediff-4.0.1-alpha ``` - Checkout working commit in stack-orchestrator repo. ```bash # In stack-orchestrator repo. - git checkout 3bb1796a59827fb755410c5ce69fac567a0f832b + git checkout 42af57a2963bb6ca55fb5fcb16ed75b39fae60f9 ``` ## Run