|
|
08a09bd |
#!/bin/bash
|
|
|
08a09bd |
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
|
|
08a09bd |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
08a09bd |
#
|
|
|
08a09bd |
# runtest.sh of /CoreOS/postgresql/Sanity/pg_repack
|
|
|
08a09bd |
# Description: Sanity test for pg_repackaudit extension
|
|
|
08a09bd |
# Author: Honza Horak <hhorak@redhat.com>
|
|
|
08a09bd |
#
|
|
|
08a09bd |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
08a09bd |
#
|
|
|
08a09bd |
# Copyright (c) 2015 Red Hat, Inc.
|
|
|
08a09bd |
#
|
|
|
08a09bd |
# This program is free software: you can redistribute it and/or
|
|
|
08a09bd |
# modify it under the terms of the GNU General Public License as
|
|
|
08a09bd |
# published by the Free Software Foundation, either version 2 of
|
|
|
08a09bd |
# the License, or (at your option) any later version.
|
|
|
08a09bd |
#
|
|
|
08a09bd |
# This program is distributed in the hope that it will be
|
|
|
08a09bd |
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
08a09bd |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
08a09bd |
# PURPOSE. See the GNU General Public License for more details.
|
|
|
08a09bd |
#
|
|
|
08a09bd |
# You should have received a copy of the GNU General Public License
|
|
|
08a09bd |
# along with this program. If not, see http://www.gnu.org/licenses/.
|
|
|
08a09bd |
#
|
|
|
08a09bd |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
08a09bd |
|
|
|
08a09bd |
# Include Beaker environment
|
|
|
08a09bd |
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
|
|
08a09bd |
|
|
|
08a09bd |
PACKAGE="postgresql"
|
|
|
08a09bd |
|
|
|
08a09bd |
rlJournalStart
|
|
|
08a09bd |
rlPhaseStart FAIL "Setup"
|
|
|
eef7ba6 |
rlRun "rlImport database/postgresql"
|
|
|
08a09bd |
PACKAGES="$PACKAGES ${postgresqlPackagePrefix}pg_repack \
|
|
|
08a09bd |
${postgresqlPackagePrefix}${PACKAGE} \
|
|
|
08a09bd |
${postgresqlPackagePrefix}${PACKAGE}-contrib \
|
|
|
08a09bd |
${postgresqlPackagePrefix}${PACKAGE}-server";
|
|
|
08a09bd |
for PACKAGE in $PACKAGES; do
|
|
|
08a09bd |
rlAssertRpm $PACKAGE
|
|
|
08a09bd |
done
|
|
|
08a09bd |
rlRun "postgresqlStop";
|
|
|
08a09bd |
[[ -d ${postgresqlDataDir} ]] && rlFileBackup "${postgresqlDataDir}"
|
|
|
08a09bd |
rlRun "postgresqlCleanup"
|
|
|
08a09bd |
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
|
|
08a09bd |
rlRun "pushd $TmpDir"
|
|
|
08a09bd |
rlRun "postgresqlStart"
|
|
|
08a09bd |
rlPhaseEnd
|
|
|
08a09bd |
|
|
|
08a09bd |
rlPhaseStartTest
|
|
|
08a09bd |
rlRun "postgresqlQuery \"DROP EXTENSION IF EXISTS pg_repack;\"";
|
|
|
08a09bd |
rlRun "postgresqlQuery \"CREATE DATABASE testrepack;\"" 0;
|
|
|
08a09bd |
rlRun "postgresqlQuery \"CREATE EXTENSION pg_repack;\" testrepack" 0;
|
|
|
e2c6ccc |
rlRun "postgresqlExec 'pgbench -i -s 50 testrepack' postgres"
|
|
|
e2c6ccc |
rlRun "postgresqlExec 'pg_repack --no-order --table pgbench_accounts testrepack -e' postgres"
|
|
|
e2c6ccc |
rlRun "postgresqlQuery \"DROP EXTENSION pg_repack;\" testrepack";
|
|
|
08a09bd |
rlRun "postgresqlQuery \"DROP DATABASE testrepack;\"" 0;
|
|
|
08a09bd |
rlPhaseEnd
|
|
|
08a09bd |
|
|
|
08a09bd |
rlPhaseStart WARN "Cleanup";
|
|
|
08a09bd |
rm -f $rlRun_LOG;
|
|
|
08a09bd |
rlRun "postgresqlCleanup";
|
|
|
08a09bd |
rlFileRestore;
|
|
|
08a09bd |
rlRun "popd"
|
|
|
08a09bd |
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
|
|
08a09bd |
rlPhaseEnd
|
|
|
08a09bd |
rlJournalPrintText
|
|
|
08a09bd |
rlJournalEnd
|