forked from cerc-io/ipld-eth-server
Update scripts to run unit tests using TimescaleDB
This commit is contained in:
parent
9676690a2d
commit
dc14656bbc
22
.github/workflows/run_unit_test.sh
vendored
22
.github/workflows/run_unit_test.sh
vendored
@ -8,22 +8,30 @@ temp_dir=$(mktemp -d)
|
||||
cd $temp_dir
|
||||
git clone -b $(cat /tmp/git_head_ref) "https://github.com/$(cat /tmp/git_repository).git"
|
||||
cd ipld-eth-server
|
||||
mkdir -p out
|
||||
|
||||
## Remove the branch and github related info. This way future runs wont be confused.
|
||||
rm -f /tmp/git_head_ref /tmp/git_repository
|
||||
|
||||
# Spin up DB
|
||||
docker-compose up -d ipld-eth-db
|
||||
trap "docker-compose down --remove-orphans; cd $start_dir ; rm -r $temp_dir" SIGINT SIGTERM ERR
|
||||
sleep 10
|
||||
# Remove existing docker-tsdb directory
|
||||
rm -rf out/docker-tsdb/
|
||||
|
||||
# Copy over files to setup TimescaleDB
|
||||
ID=$(docker create vulcanize/ipld-eth-db:v4.1.1-alpha)
|
||||
docker cp $ID:/app/docker-tsdb out/docker-tsdb/
|
||||
docker rm -v $ID
|
||||
|
||||
# Spin up TimescaleDB
|
||||
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml up ipld-eth-db
|
||||
trap "docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes; cd $start_dir ; rm -r $temp_dir" SIGINT SIGTERM ERR
|
||||
sleep 45
|
||||
|
||||
# Remove old logs so there's no confusion, then run test
|
||||
rm -f /tmp/test.log /tmp/return_test.txt
|
||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test > /tmp/test.log
|
||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8066 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing_v4 make test > /tmp/test.log
|
||||
echo $? > /tmp/return_test.txt
|
||||
|
||||
# Clean up
|
||||
docker-compose down -v --remove-orphans
|
||||
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes
|
||||
cd $start_dir
|
||||
rm -fr $temp_dir
|
||||
|
||||
|
@ -2,17 +2,16 @@ version: '3.2'
|
||||
|
||||
services:
|
||||
ipld-eth-db:
|
||||
restart: always
|
||||
image: vulcanize/ipld-eth-db:v3.2.0
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
- access-node
|
||||
image: vulcanize/ipld-eth-db:v4.1.1-alpha
|
||||
environment:
|
||||
POSTGRES_USER: "vdbm"
|
||||
POSTGRES_DB: "vulcanize_testing"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
volumes:
|
||||
- vdb_db_eth_server:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "127.0.0.1:8077:5432"
|
||||
command: ["postgres", "-c", "log_statement=all"]
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_NAME: "vulcanize_testing_v4"
|
||||
DATABASE_PASSWORD: "password"
|
||||
DATABASE_HOSTNAME: "access-node"
|
||||
DATABASE_PORT: 5432
|
||||
|
||||
eth-server:
|
||||
restart: unless-stopped
|
||||
|
@ -1,8 +1,26 @@
|
||||
# Clear up existing docker images and volume.
|
||||
docker-compose down --remove-orphans --volumes
|
||||
#!/bin/bash
|
||||
|
||||
docker-compose -f docker-compose.yml up -d ipld-eth-db
|
||||
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
|
||||
set -e
|
||||
|
||||
docker-compose down --remove-orphans --volumes
|
||||
mkdir -p out
|
||||
|
||||
# Remove existing docker-tsdb directory
|
||||
rm -rf out/docker-tsdb/
|
||||
|
||||
# Copy over files to setup TimescaleDB
|
||||
ID=$(docker create vulcanize/ipld-eth-db:v4.1.1-alpha)
|
||||
docker cp $ID:/app/docker-tsdb out/docker-tsdb/
|
||||
docker rm -v $ID
|
||||
|
||||
# Spin up TimescaleDB
|
||||
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml up ipld-eth-db
|
||||
trap "docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes; rm -rf out/" SIGINT SIGTERM ERR
|
||||
sleep 45
|
||||
|
||||
# Run unit tests
|
||||
go clean -testcache
|
||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8066 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing_v4 make test
|
||||
|
||||
# Clean up
|
||||
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes
|
||||
rm -rf out/
|
||||
|
Loading…
Reference in New Issue
Block a user