Add functional tests

This commit is contained in:
Dmitry Petrov
2017-03-20 01:30:53 -07:00
parent c8fcd28eb3
commit 9f0e4b51f2
4 changed files with 65 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
source common.rc
rm -rf $RAW_DATA_LOCAL $CODE_LOCAL
+27
View File
@@ -0,0 +1,27 @@
BASE_DIR_S3=https://s3-us-west-2.amazonaws.com/dataversioncontrol
RAW_DATA_S3=$BASE_DIR_S3/stackoverflow_raw_small
RAW_DATA_LOCAL=sync_raw_data
CODE_LOCAL=sync_code
TEST_REPO=repo_clean
TEST_REPO=repo_clean
function _init_repo() {
git init
dvc-init
mkdir data/xml
dvc-data-import ../$RAW_DATA_LOCAL/* data/xml
mkdir code
cp ../$CODE_LOCAL/* code/
git add code/
git commit -m 'Add code'
}
function create_repo() {
rm -rf $TEST_REPO
mkdir $TEST_REPO
(cd $TEST_REPO && _init_repo)
}
+16
View File
@@ -0,0 +1,16 @@
source common.rc
./clean.sh
rm -rf $RAW_DATA_LOCAL
mkdir $RAW_DATA_LOCAL
for file in "Badges.xml" "Tags.xml" "PostLinks.xml"
do
(cd $RAW_DATA_LOCAL; wget $RAW_DATA_S3/$file)
done
rm -rf $CODE_LOCAL
mkdir $CODE_LOCAL
(cd $CODE_LOCAL; wget "$BASE_DIR_S3/functests/code/xmltotsv.py")
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
source common.rc
function run_test() {
mkdir data/tsv
dvc-run --code code/xmltotsv.py python code/xmltotsv.py --extract row/@Id,row/@UserId,row/@Name,row/@Class,row/@TagBased,row/@Date data/xml/Badges.xml data/tsv/Badges.tsv
echo " " >> code/xmltotsv.py
git commit -am 'Change code'
dvc-repro data/tsv/Badges.tsv
}
TEST_REPO=repo_repro_test
create_repo
(cd repo_repro_test; run_test)