Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the travis build #612

Merged
merged 2 commits into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
language: python
matrix:
include:
- python: 3.6
dist: bionic
- python: 3.7
dist: bionic
python:
- "3.6"
- "3.7"
- "3.8"
services:
- docker
before_install:
- test/travis_before_install.sh
- postgresql
install:
- pip install -r backend/requirements.txt
- pip install -r test/requirements.txt
- pip install -r scripts/importer/requirements.txt
- pip install coverage coveralls
- pip install pylint
script:
- test/travis_script.sh
addons:
postgresql: "10"
apt:
packages:
- postgresql-client-10
2 changes: 2 additions & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pytest-cov
coveralls
pylint
8 changes: 0 additions & 8 deletions test/travis_before_install.sh

This file was deleted.

32 changes: 16 additions & 16 deletions test/travis_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@ echo '>>> Preparing for testing: Fix settings.json file'
cp settings_sample.json settings.json

sed -i.tmp 's/"postgresHost" : "postgres host"/"postgresHost" : "127.0.0.1"/' settings.json
sed -i.tmp 's/"postgresPort" : 5432/"postgresPort" : 5433/' settings.json
sed -i.tmp "s/\"postgresName\" : \"swefreq\"/\"postgresName\" : \"$DBNAME\"/" settings.json

echo 'SETTINGS'
cat settings.json
echo '/SETTINGS'


echo '>>> Test 1: The SQL Patch'

LATEST_RELEASE=$(git tag | grep '^v' | sort -V | tail -n 1)
git show "$LATEST_RELEASE:sql/*_schema.sql" > master-schema.sql

psql -U postgres -h 127.0.0.1 -p 5433 -f master-schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -p 5433 -f sql/patch-master-db.sql "$DBNAME"
echo "CREATE DATABASE $DBNAME" > create_db.sql
psql -U postgres -h 127.0.0.1 -f create_db.sql
psql -U postgres -h 127.0.0.1 -f master-schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -f sql/patch-master-db.sql "$DBNAME"

# Empty the database
psql -U postgres -h 127.0.0.1 -p 5433 "$DBNAME" <<__END__
psql -U postgres -h 127.0.0.1 "$DBNAME" <<__END__
DROP SCHEMA data CASCADE;
DROP SCHEMA users CASCADE;
__END__


echo '>>> Test 2: Load the swefreq schema'
psql -U postgres -h 127.0.0.1 -p 5433 -f sql/data_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -p 5433 -f sql/user_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -p 5433 -f sql/beacon_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -p 5433 -f test/data/load_dummy_data.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -p 5433 -f test/data/browser_test_data.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -f sql/data_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -f sql/user_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -f sql/beacon_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -f test/data/load_dummy_data.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -f test/data/browser_test_data.sql "$DBNAME"


echo '>>> Test 3: Check that the backend starts'
Expand Down Expand Up @@ -83,13 +83,13 @@ sleep 2 # Lets wait a little bit so the server has stopped


echo '>>> Prepare for test 5'
psql -U postgres -h 127.0.0.1 -p 5433 "$DBNAME" <<__END__
psql -U postgres -h 127.0.0.1 "$DBNAME" <<__END__
DROP SCHEMA data CASCADE;
DROP SCHEMA users CASCADE;
__END__

psql -U postgres -h 127.0.0.1 -p 5433 -f sql/data_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -p 5433 -f sql/user_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -f sql/data_schema.sql "$DBNAME"
psql -U postgres -h 127.0.0.1 -f sql/user_schema.sql "$DBNAME"

BASE=scripts/importer
ln -s tests/data "$BASE/downloaded_files"
Expand All @@ -114,7 +114,7 @@ scripts/manage.sh import --add_reference\
--ref_name GRCh37p13

# read dataset names, versions etc
psql -U postgres -h 127.0.0.1 -p 5433 -f "$BASE/tests/data/base_info.sql" "$DBNAME"
psql -U postgres -h 127.0.0.1 -f "$BASE/tests/data/base_info.sql" "$DBNAME"


# read variant data
Expand Down Expand Up @@ -144,7 +144,7 @@ scripts/manage.sh import --add_raw_data \

# make pg_dump
# compare file to reference; must remove comments, empty rows and id column
pg_dump -U postgres -h 127.0.0.1 -p 5433 "$DBNAME" -f dbdump.psql --data-only
pg_dump -U postgres -h 127.0.0.1 "$DBNAME" -f dbdump.psql --data-only
sed -i -r -e '/^--/d;/^$/d;s/^[0-9]+[^I]//' dbdump.psql
grep -v -P "^SE[TL]" dbdump.psql | sort > sdump.psql
sed -i -r -e 's/^[0-9]+[^I]//' "$BASE/tests/data/reference.psql"
Expand All @@ -164,7 +164,7 @@ sed -i -e 's/import_4/mate_1/' scripts/manage.sh
--add_reversed_mates \
--variant_file "$BASE/tests/data/manta.vcf"

psql -U postgres -h 127.0.0.1 -p 5433 "$DBNAME" -c "select chrom_id, pos, ref, alt, chrom, mate_chrom, mate_start, mate_id, allele_freq, variant_id, allele_count, allele_num from data.mates ;" > mates_res.txt
psql -U postgres -h 127.0.0.1 "$DBNAME" -c "select chrom_id, pos, ref, alt, chrom, mate_chrom, mate_start, mate_id, allele_freq, variant_id, allele_count, allele_num from data.mates ;" > mates_res.txt
diff mates_res.txt "$BASE/tests/data/mates_reference.txt"
RETURN_VALUE=$((RETURN_VALUE + $?))

Expand Down