summaryrefslogtreecommitdiffstats
path: root/postgresql-tests/gen-data/databases
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2014-10-22 08:54:05 +0200
committerPavel Raiskup <praiskup@redhat.com>2014-10-22 08:54:05 +0200
commit2422a081a5be0d5ac5afb122361bc283da67341f (patch)
treecb255582060af6547dd9318c56ba0e8c761846a1 /postgresql-tests/gen-data/databases
parent922089746e1029de9be986672fcdeb6bc82e18d7 (diff)
downloadpostgresql-setup-tests-2422a081a5be0d5ac5afb122361bc283da67341f.tar.gz
postgresql-setup-tests-2422a081a5be0d5ac5afb122361bc283da67341f.tar.xz
postgresql-setup-tests-2422a081a5be0d5ac5afb122361bc283da67341f.zip
big reorg: prepare for generalization
Try to split into three separate components -> controller, tester, and 'tasks' (postgresql-tasks in our case). The controller component is the main part which is able to run the task remotely. Tester is more-like library for 'tasks' component (should be reusable on the raw git level). * controller: Almost separated component. * postgresql-tasks: Likewise. * tester: Likewise.
Diffstat (limited to 'postgresql-tests/gen-data/databases')
-rw-r--r--postgresql-tests/gen-data/databases/pagila.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/postgresql-tests/gen-data/databases/pagila.sh b/postgresql-tests/gen-data/databases/pagila.sh
new file mode 100644
index 0000000..a01d818
--- /dev/null
+++ b/postgresql-tests/gen-data/databases/pagila.sh
@@ -0,0 +1,39 @@
+create_pagila()
+(
+ testit()
+ {
+ debug "testing database"
+
+ local cmd="psql -tA -d pagila -c \"select city from city where city = 'Banjul';\""
+
+ out="$(admin_cmd "$cmd")"
+ test "$out" = Banjul || return 1
+ test "$(wc -l < pagila_init.log)" -gt 335 || return 1
+
+ test "$({ grep ERROR | wc -l ; } < pagila_init.log)" -lt 2
+ }
+
+ debug "creating DB pagilla"
+ INDENT="$INDENT "
+
+ pagila="pagila-0.10.1"
+ pagila_tarball="$pagila.zip"
+ pagila_link="http://pgfoundry.org/frs/download.php/1719/$pagila_tarball"
+
+ cached_download $pagila_link
+
+ debug "unzipping tarball"
+ unzip $pagila_tarball &>/dev/null || die "can not unzip pagila"
+
+ pushd $pagila >/dev/null || die "can not switch directory"
+ admin_cmd "createdb pagila --owner postgres" || die "can't create db"
+ { su - postgres -c 'psql -d pagila' < pagila-schema.sql \
+ && su - postgres -c 'psql -d pagila' < pagila-data.sql
+ } &>pagila_init.log || die "can not initialize pagila"
+
+ cp pagila_init.log /tmp
+
+ testit || die "can not test"
+
+ popd >/dev/null || die "can't go back"
+)