-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
210 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,7 @@ pushcsv | |
|
||
\.DS_Store | ||
|
||
*.nupkg | ||
*.nupkg | ||
|
||
# test env | ||
test/logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<img src="art/logo.svg" width="128"/> | ||
|
||
# pushcsv | ||
Push csv/tsv data to database | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# all test cases for pushcsv | ||
# TESTCONFIG is setup with pushcsv arguments (db rui and table) by each | ||
# database test script | ||
# -h argument requests to use --headers argument on test cases e.g. mongodb | ||
# tests need headers for object property names | ||
|
||
# report result of last command | ||
# $1 is test name | ||
function report() { | ||
if [ $? -eq 0 ]; then | ||
echo -e $PASS $1 | ||
else | ||
echo -e $FAIL $1 | ||
fi | ||
} | ||
|
||
export -f report | ||
|
||
# run tests | ||
$TESTCASES/test-encoding.sh $* | ||
$TESTCASES/test-pushall.sh $* | ||
$TESTCASES/test-pushmap.sh $* | ||
$TESTCASES/test-purge.sh $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
echo "testing support for various csv encoding..." | ||
|
||
TESTARGS="--debug --trace >>$LOGFILE 2>&1" | ||
if [[ $3 == "-h" ]]; then | ||
TESTARGS="--headers "$TESTARGS | ||
fi | ||
|
||
# test pushing utf-8 csv input | ||
eval pushcsv $1 $2 $ASSETS/test-utf8.csv $TESTARGS | ||
report "utf-8 test" | ||
|
||
# test pushing utf-8 with BOM csv input | ||
eval pushcsv $1 $2 $ASSETS/test-utf8bom.csv $TESTARGS | ||
report "utf-8 BOM test" | ||
|
||
# test pushing utf-16 csv input | ||
eval pushcsv $1 $2 $ASSETS/test-utf16.csv $TESTARGS | ||
report "utf-16 test" | ||
|
||
# test pushing utf-16 with BOM csv input | ||
eval pushcsv $1 $2 $ASSETS/test-utf16be.csv $TESTARGS | ||
report "utf-16 BOM test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo "testing purging existing db objects..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo "testing pushing all fields to database..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo "testing pushing mapped fields to database..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#! | ||
echo "running pushcsv tests on mongodb..." | ||
|
||
# mongodb root account | ||
ROOTU="mdbroot" | ||
ROOTP="mdbrootpass" | ||
|
||
# mongodb user for this test | ||
TESTU="pushcsvtestuser" | ||
TESTP="testpass" | ||
|
||
# database and collection for this test | ||
TESTDB="pushcsvtestdb" | ||
TESTCOL="testcollection" | ||
|
||
printf $PROGRESSPRINT "pulling docker images and starting a container..." | ||
# pull docker container and create the root user | ||
docker run -d --name pushcsvtestmongo \ | ||
-p 127.0.0.1:27017:27017/tcp \ | ||
-e MONGO_INITDB_ROOT_USERNAME=$ROOTU -e MONGO_INITDB_ROOT_PASSWORD=$ROOTP mongo \ | ||
>>$LOGFILE 2>&1 | ||
# wait for container to start | ||
sleep 2 | ||
|
||
printf $PROGRESSPRINT "configuring test db..." | ||
# report mongodb version | ||
echo "mongo --version" | docker exec -i pushcsvtestmongo bash >>$LOGFILE 2>&1 | ||
sleep 2 | ||
|
||
# switch to test db and add test user | ||
echo "use $TESTDB | ||
db.createUser({user: \"$TESTU\", pwd: \"$TESTP\", roles: [\"dbOwner\"]}) | ||
exit | ||
" | docker exec -i pushcsvtestmongo mongo -u $ROOTU -p $ROOTP >>$LOGFILE 2>&1 | ||
sleep 2 | ||
|
||
printf $PROGRESSPRINT | ||
|
||
# export the db config and run tests | ||
$TESTCASES/test-all.sh "mongodb://$TESTU:$TESTP@localhost:27017/$TESTDB" $TESTCOL -h | ||
|
||
printf $PROGRESSPRINT "cleaning up..." | ||
docker stop pushcsvtestmongo >>$LOGFILE 2>&1 | ||
docker rm pushcsvtestmongo >>$LOGFILE 2>&1 | ||
docker rmi mongo >>$LOGFILE 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#! | ||
echo "running pushcsv tests on mysql..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#! | ||
echo "running pushcsv tests on postgresql..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#! | ||
echo "running pushcsv tests on sqlite3..." | ||
|
||
# TABLENAME="sqlitetesttable" | ||
# TESTDB=$TESTPATH/sqlitetestdb.db | ||
|
||
# # export the db config and run tests | ||
# $TESTCASES/test-all.sh "sqlite3:$TESTDB" $TABLENAME | ||
|
||
# printf $PROGRESSPRINT "cleaning up..." | ||
# # rm $TESTDB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#! | ||
echo "running pushcsv tests on ms-sql-server..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#! | ||
echo "setting up test environment..." | ||
cat /dev/null > $LOGFILE | ||
echo "log file "$LOGFILE | ||
|
||
echo "running on "$(uname -a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#! | ||
echo "tearing down test environment..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#! /bin/bash | ||
# globals | ||
export TESTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
export TESTENV=$TESTPATH/env | ||
export DBTESTS=$TESTPATH/dbs | ||
export TESTCASES=$TESTPATH/cases | ||
export ASSETS=$TESTPATH/assets | ||
export LOGPATH=$TESTPATH/logs | ||
|
||
# green PASS | ||
export PASS="[ \033[32mPASS\033[39m ]" | ||
# red FAIL | ||
export FAIL="[ \033[31mFAIL\033[39m ]" | ||
export PROGRESSPRINT="%-120s\r" | ||
|
||
# get HEAD commit hash for this test | ||
export HEADHASH=`git describe --always` | ||
export LOGFILE=$LOGPATH/$HEADHASH"_test.log" | ||
|
||
# setup | ||
$TESTENV/setup-env.sh | tee -a $LOGFILE | ||
|
||
# db tests | ||
$DBTESTS/test-postgres.sh | tee -a $LOGFILE | ||
$DBTESTS/test-monogdb.sh | tee -a $LOGFILE | ||
$DBTESTS/test-mysql.sh | tee -a $LOGFILE | ||
$DBTESTS/test-sqlserver.sh | tee -a $LOGFILE | ||
$DBTESTS/test-sqlite.sh | tee -a $LOGFILE | ||
|
||
# teardown | ||
$TESTENV/teardown-env.sh | tee -a $LOGFILE |