Update unit test to use stack-orchestrator
This commit is contained in:
parent
f8de0defad
commit
b7b4631231
33
.github/workflows/run_unit_test.sh
vendored
33
.github/workflows/run_unit_test.sh
vendored
@ -8,30 +8,35 @@ temp_dir=$(mktemp -d)
|
|||||||
cd $temp_dir
|
cd $temp_dir
|
||||||
git clone -b $(cat /tmp/git_head_ref) "https://github.com/$(cat /tmp/git_repository).git"
|
git clone -b $(cat /tmp/git_head_ref) "https://github.com/$(cat /tmp/git_repository).git"
|
||||||
cd ipld-eth-server
|
cd ipld-eth-server
|
||||||
mkdir -p out
|
|
||||||
|
|
||||||
## Remove the branch and github related info. This way future runs wont be confused.
|
## Remove the branch and github related info. This way future runs wont be confused.
|
||||||
rm -f /tmp/git_head_ref /tmp/git_repository
|
#rm -f /tmp/git_head_ref /tmp/git_repository
|
||||||
|
|
||||||
# Remove existing docker-tsdb directory
|
# Setup the DB
|
||||||
rm -rf out/docker-tsdb/
|
cd $temp_dir
|
||||||
|
git clone "https://github.com/vulcanize/ipld-eth-db.git"; cd ipld-eth-db; git checkout $(cat /tmp/ipld_eth_db_ref)
|
||||||
|
|
||||||
# Copy over files to setup TimescaleDB
|
# Spin Up DB using Stack Orchestrator
|
||||||
ID=$(docker create vulcanize/ipld-eth-db:v4.1.3-alpha)
|
cd $temp_dir
|
||||||
docker cp $ID:/app/docker-tsdb out/docker-tsdb/
|
git clone "https://github.com/vulcanize/stack-orchestrator.git"; cd stack-orchestrator; git checkout $(cat /tmp/stack_orchestrator_ref)
|
||||||
docker rm -v $ID
|
|
||||||
|
|
||||||
# Spin up TimescaleDB
|
cd ${temp_dir}/stack-orchestrator
|
||||||
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml up ipld-eth-db
|
echo vulcanize_ipld_eth_db=${temp_dir}/ipld-eth-db > ./config.sh
|
||||||
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 existing containers if they are present
|
||||||
|
docker-compose -f docker/local/docker-compose-db-sharding.yml --env-file ./config.sh down -v --remove-orphans;
|
||||||
|
|
||||||
|
trap 'cd ${temp_dir}/stack-orchestrator; docker-compose -f docker/local/docker-compose-db-sharding.yml --env-file ./config.sh down -v --remove-orphans; ' SIGINT SIGTERM
|
||||||
|
docker-compose -f docker/local/docker-compose-db-sharding.yml --env-file ./config.sh up -d
|
||||||
|
|
||||||
# Remove old logs so there's no confusion, then run test
|
# Remove old logs so there's no confusion, then run test
|
||||||
rm -f /tmp/test.log /tmp/return_test.txt
|
rm -f /tmp/test.log /tmp/return_test.txt
|
||||||
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
|
cd ${temp_dir}/ipld-eth-server
|
||||||
|
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=localhost DATABASE_NAME=vulcanize_testing make test > /tmp/test.log
|
||||||
echo $? > /tmp/return_test.txt
|
echo $? > /tmp/return_test.txt
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
docker-compose -f out/docker-tsdb/docker-compose.test.yml -f docker-compose.yml down --remove-orphans --volumes
|
|
||||||
|
cd ${temp_dir}/stack-orchestrator; docker-compose -f docker/local/docker-compose-db-sharding.yml --env-file ./config.sh down -v --remove-orphans
|
||||||
cd $start_dir
|
cd $start_dir
|
||||||
rm -fr $temp_dir
|
rm -fr $temp_dir
|
||||||
|
8
.github/workflows/tests.yaml
vendored
8
.github/workflows/tests.yaml
vendored
@ -46,6 +46,8 @@ jobs:
|
|||||||
- name: Output variables to files
|
- name: Output variables to files
|
||||||
run: |
|
run: |
|
||||||
echo $GITHUB_REPOSITORY > /tmp/git_repository
|
echo $GITHUB_REPOSITORY > /tmp/git_repository
|
||||||
|
echo ${{ inputs.STACK_ORCHESTRATOR_REF }} > /tmp/ipld_eth_db_ref
|
||||||
|
echo ${{ inputs.IPLD_ETH_DB_REF }} > /tmp/stack_orchestrator_ref
|
||||||
[ -z "$GITHUB_HEAD_REF" ] && echo $GITHUB_REF_NAME > /tmp/git_head_ref || echo $GITHUB_HEAD_REF > /tmp/git_head_ref
|
[ -z "$GITHUB_HEAD_REF" ] && echo $GITHUB_REF_NAME > /tmp/git_head_ref || echo $GITHUB_HEAD_REF > /tmp/git_head_ref
|
||||||
echo "-----BEGIN OPENSSH PRIVATE KEY-----" >> /tmp/key
|
echo "-----BEGIN OPENSSH PRIVATE KEY-----" >> /tmp/key
|
||||||
echo ${{ env.BUILD_KEY }} >> /tmp/key
|
echo ${{ env.BUILD_KEY }} >> /tmp/key
|
||||||
@ -58,6 +60,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_repository ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_repository
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_repository ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_repository
|
||||||
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_head_ref ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_head_ref
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_head_ref ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_head_ref
|
||||||
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/stack_orchestrator_ref ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/stack_orchestrator_ref
|
||||||
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/ipld_eth_db_ref ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/ipld_eth_db_ref
|
||||||
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key .github/workflows/run_unit_test.sh ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/run_unit_test.sh
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key .github/workflows/run_unit_test.sh ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/run_unit_test.sh
|
||||||
|
|
||||||
- name: Trigger Unit Test
|
- name: Trigger Unit Test
|
||||||
@ -106,7 +110,7 @@ jobs:
|
|||||||
path: "./go-ethereum/"
|
path: "./go-ethereum/"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ env.IPLD_ETH_DB_REF }}
|
ref: ${{ inputs.IPLD_ETH_DB_REF }}
|
||||||
repository: vulcanize/ipld-eth-db
|
repository: vulcanize/ipld-eth-db
|
||||||
path: "./ipld-eth-db/"
|
path: "./ipld-eth-db/"
|
||||||
- name: Create config file
|
- name: Create config file
|
||||||
@ -175,7 +179,7 @@ jobs:
|
|||||||
path: "./go-ethereum/"
|
path: "./go-ethereum/"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ env.IPLD_ETH_DB_REF }}
|
ref: ${{ inputs.IPLD_ETH_DB_REF }}
|
||||||
repository: vulcanize/ipld-eth-db
|
repository: vulcanize/ipld-eth-db
|
||||||
path: "./ipld-eth-db/"
|
path: "./ipld-eth-db/"
|
||||||
- name: Create config file
|
- name: Create config file
|
||||||
|
Loading…
Reference in New Issue
Block a user