summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib_pgsql.sh41
-rwxr-xr-xrun1
-rw-r--r--tasks/upgrade-basic/config.sh2
-rw-r--r--tasks/upgrade-basic/runtest.sh38
4 files changed, 82 insertions, 0 deletions
diff --git a/lib_pgsql.sh b/lib_pgsql.sh
index 3e8e047..6805cdb 100644
--- a/lib_pgsql.sh
+++ b/lib_pgsql.sh
@@ -58,3 +58,44 @@ dtf_postgresql_test_finish()
rlJournalEnd
rlGetTestState || return 1
}
+
+dtf_postgresql_unpack_remote_data()
+(
+ local tarball="$1"
+ cd /var/lib/pgsql || return 1
+ set -o pipefail
+ echo "downloading '$tarball'"
+ curl "$tarball" | tar -xzf -
+)
+
+# Detect current distribution and print set of "distro version action" lines
+# where DISTRO may be rhel/fedora, VERSION may be e.g. 6.6 for rhel or 20 for
+# Fedora. ACTION is either run or upgrade and it means whether currently
+# installed PostgreSQL server is able to RUN the older data from DISTRO-VERSION
+# or it should be first UPGRADEd.
+#
+# What versions are currently in Fedoras:
+# f17(9.1.9); f18(9.2.5); f19(9.2.9); f20(9.3.5); f21(9.3.5);
+# rawhide(9.3.5)
+
+dtf_postgresql_upgrade_matrix()
+{
+ if rlIsFedora 19; then
+ # echo fedora 17 upgrade
+ # echo fedora 18 run
+ echo fedora 19 run
+ elif rlIsFedora 20; then
+ # echo fedora 18 upgrade
+ echo fedora 19 upgrade
+ echo fedora 20 run
+ elif rlIsFedora 21; then
+ echo fedora 19 upgrade
+ echo fedora 20 run
+ # echo fedora 21 run
+ elif rlIsFedora 22; then
+ echo fedora 19 upgrade
+ echo fedora 20 run
+ # echo fedora 21 run
+ # echo fedora 22 run
+ fi
+}
diff --git a/run b/run
index 4e11dd5..8f1b69f 100755
--- a/run
+++ b/run
@@ -5,6 +5,7 @@
export dtf_resultdir=${dtf_resultdir_override-/var/tmp/dtf}
export dtf_srcdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
export dtf_testdir=${dtf_testdir-$dtf_srcdir}
+export dtf_dataurl=http://pensioner.lab.eng.brq.redhat.com/root-tests/data/postgresql/
export dtf_resultxml_file=/var/tmp/dtf.xml
diff --git a/tasks/upgrade-basic/config.sh b/tasks/upgrade-basic/config.sh
new file mode 100644
index 0000000..a1d4a2f
--- /dev/null
+++ b/tasks/upgrade-basic/config.sh
@@ -0,0 +1,2 @@
+export DTF_TEST_ID="basic-upgrade"
+export DTF_TEST_DESCRIPTION="Check postgresql-setup [--]upgrade"
diff --git a/tasks/upgrade-basic/runtest.sh b/tasks/upgrade-basic/runtest.sh
new file mode 100644
index 0000000..3863479
--- /dev/null
+++ b/tasks/upgrade-basic/runtest.sh
@@ -0,0 +1,38 @@
+arch=$(uname -i)
+
+dtf_postgresql_test_init
+
+test_wrapper()
+{
+ dtf_postgresql_upgrade_matrix | \
+ while read distro version action; do
+ echo "performing upgrade: $distro-$version - $action"
+
+ url="$dtf_dataurl/$distro/$version/$arch/basic.tar.gz"
+
+ dtf_postgresql_unpack_remote_data "$url" || return 1
+
+ case "$action" in
+ upgrade)
+ if rlIsFedora 22; then
+ dashdash="--"
+ fi
+ rlRun "postgresql-setup $dashdash""upgrade"
+ ;;
+ *)
+ ;;
+ esac
+
+ rlServiceStart postgresql
+ dtf_postgresql_check_started
+ rlServiceStop postgresql
+ dtf_postgresql_check_stopped
+
+ rm -rf /var/lib/pgsql/data
+ done
+}
+
+test_wrapper
+rlAssert0 "test_wrapper() should finish successfully" $?
+
+dtf_postgresql_test_finish