diff --git a/Sanity/pg_repack/main.fmf b/Sanity/pg_repack/main.fmf new file mode 100644 index 0000000..a7c032a --- /dev/null +++ b/Sanity/pg_repack/main.fmf @@ -0,0 +1,27 @@ +summary: Sanity test for pg_repack extension +description: '' +contact: Vaclav Danek +component: +- pg_repack +test: ./runtest.sh +path: /Sanity/pg_repack +framework: beakerlib +require: +- url: https://github.com/beakerlib/database.git + name: /postgresql + ref: master +recommend: +- postgresql-server +- postgresql-contrib +- pg_repack +duration: 5m +enabled: true +tag: +- NoRHEL4 +- NoRHEL5 +- NoRHEL6 +- TIPfail +- TIPfail_Apps +- Tier1 +tier: '1' +extra-task: /CoreOS/postgresql/Sanity/pg_repack diff --git a/Sanity/pg_repack/runtest.sh b/Sanity/pg_repack/runtest.sh new file mode 100755 index 0000000..2b77121 --- /dev/null +++ b/Sanity/pg_repack/runtest.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/postgresql/Sanity/pg_repack +# Description: Sanity test for pg_repackaudit extension +# Author: Honza Horak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="postgresql" + +rlJournalStart + rlPhaseStart FAIL "Setup" + #rlRun "rlImport database/postgresql" + rlRun "rlImport postgresql/basic" + PGDATA="$(postgresqlGetDataDir)"; + PACKAGES="$PACKAGES ${postgresqlPackagePrefix}pg_repack \ + ${postgresqlPackagePrefix}${PACKAGE} \ + ${postgresqlPackagePrefix}${PACKAGE}-contrib \ + ${postgresqlPackagePrefix}${PACKAGE}-server"; + for PACKAGE in $PACKAGES; do + rlAssertRpm $PACKAGE + done + rlRun "postgresqlStop"; + [[ -d ${postgresqlDataDir} ]] && rlFileBackup "${postgresqlDataDir}" + rlRun "postgresqlCleanup" + rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlRun "postgresqlStart" + #rlRun "sed -i -e \"s/#shared_preload_libraries = ''/shared_preload_libraries = 'pgaudit'/\" ${PGDATA}/postgresql.conf" 0 "Adding pgaudit to the shared_preload_libraries in the config file ..." + #rlRun "postgresqlStop"; + #rlRun "postgresqlStart" + rlPhaseEnd + + rlPhaseStartTest + rlRun "postgresqlQuery \"DROP EXTENSION IF EXISTS pg_repack;\""; + rlRun "postgresqlQuery \"CREATE DATABASE testrepack;\"" 0; + rlRun "postgresqlQuery \"CREATE EXTENSION pg_repack;\" testrepack" 0; + rlRun "postgresqlExec 'pgbench -i -s 50 testrepack' postgres" + rlRun "postgresqlExec 'pg_repack --no-order --table pgbench_accounts testrepack -e' postgres" + rlRun "postgresqlQuery \"DROP EXTENSION pg_repack;\" testrepack"; + rlRun "postgresqlQuery \"DROP DATABASE testrepack;\"" 0; + rlPhaseEnd + + rlPhaseStart WARN "Cleanup"; + rm -f $rlRun_LOG; + rlRun "postgresqlCleanup"; + rlFileRestore; + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd