tests: depend on postgresql-setup 5.0
Version: 9.4.1210-2
This commit is contained in:
parent
853803f5e5
commit
056b7d5429
@ -1,173 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# Do some "integration" testing against running PostgreSQL server.
|
|
||||||
|
|
||||||
# This file is to be sourced.
|
|
||||||
|
|
||||||
: ${PGTESTS_DATADIR=`pwd`/datadir}
|
|
||||||
: ${PGTESTS_ADMIN=`id -u -n`}
|
|
||||||
: ${PGTESTS_ADMINDB=$PGTESTS_ADMIN}
|
|
||||||
: ${PGTESTS_ADMINPASS=$PGTESTS_ADMIN}
|
|
||||||
: ${PGTESTS_PORT=54321}
|
|
||||||
: ${PGTESTS_SOCKETDIR=/tmp}
|
|
||||||
: ${PGTESTS_USERS=test:test}
|
|
||||||
: ${PGTESTS_DATABASES=test:test}
|
|
||||||
|
|
||||||
# Stop the old cluster and/or remove it's data.
|
|
||||||
: ${PGTESTS_STARTCLEANUP=:}
|
|
||||||
|
|
||||||
# Cleanup once we exit the script.
|
|
||||||
: ${PGTESTS_CLEANUP=:}
|
|
||||||
|
|
||||||
# Cleanup once we exit the script.
|
|
||||||
: ${PGTESTS_CLEANUP=:}
|
|
||||||
|
|
||||||
export PGPORT=$PGTESTS_PORT
|
|
||||||
export PGHOST=$PGTESTS_SOCKETDIR
|
|
||||||
|
|
||||||
warning ()
|
|
||||||
{
|
|
||||||
echo >&2 " ! $*"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__trap_cb ()
|
|
||||||
{
|
|
||||||
IFS=' '
|
|
||||||
for __func in $__TRAP_ACTIONS
|
|
||||||
do
|
|
||||||
$__func
|
|
||||||
done
|
|
||||||
}
|
|
||||||
trap __trap_cb EXIT
|
|
||||||
|
|
||||||
|
|
||||||
__pgtests_initdb ()
|
|
||||||
{
|
|
||||||
initdb "$PGTESTS_DATADIR" -U "$PGTESTS_ADMIN" \
|
|
||||||
--auth-local=peer --auth-host=md5 \
|
|
||||||
${PGTESTS_LOCALE+--locale="$PGTESTS_LOCALE"}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__pgtests_start ()
|
|
||||||
{
|
|
||||||
pg_ctl -D "$PGTESTS_DATADIR" -l "$PGTESTS_DATADIR"/start.log start -o "-k $PGTESTS_SOCKETDIR -p $PGTESTS_PORT" -w
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__pgtests_create_admins_db ()
|
|
||||||
{
|
|
||||||
createdb -h "$PGTESTS_SOCKETDIR" "$PGTESTS_ADMINDB" --owner "$PGTESTS_ADMIN" -p "$PGTESTS_PORT"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__pgtests_passwd()
|
|
||||||
{
|
|
||||||
psql -d postgres --set=user="$1" --set=pass="$2" -tA \
|
|
||||||
<<<"ALTER USER :\"user\" WITH ENCRYPTED PASSWORD :'pass';"
|
|
||||||
}
|
|
||||||
|
|
||||||
pgtests_start ()
|
|
||||||
{
|
|
||||||
unset __TRAP_ACTIONS
|
|
||||||
|
|
||||||
if $PGTESTS_STARTCLEANUP; then
|
|
||||||
# We don't plan to be serious here. This pgtests_* effort is just to
|
|
||||||
# ease _testing_ against running postgresql server without too much
|
|
||||||
# writing.
|
|
||||||
if test -f "$PGTESTS_DATADIR"/postmaster.pid; then
|
|
||||||
# Give it a try.
|
|
||||||
warning "Seems like server works, trying to stop."
|
|
||||||
pg_ctl stop -D "$PGTESTS_DATADIR" -w
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Cleanup testing directory
|
|
||||||
if test -e "$PGTESTS_DATADIR"; then
|
|
||||||
warning "Removing old data directory."
|
|
||||||
rm -r "$PGTESTS_DATADIR"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
__pgtests_initdb && __TRAP_ACTIONS="pgtests_cleanup $__TRAP_ACTIONS"
|
|
||||||
__pgtests_start && __TRAP_ACTIONS="pgtests_stop $__TRAP_ACTIONS"
|
|
||||||
__pgtests_create_admins_db
|
|
||||||
|
|
||||||
__pgtests_passwd "$PGTESTS_ADMIN" "$PGTESTS_ADMINPASS"
|
|
||||||
|
|
||||||
|
|
||||||
for _pgt_user in $PGTESTS_USERS
|
|
||||||
do
|
|
||||||
save_IFS=$IFS
|
|
||||||
IFS=:
|
|
||||||
_user=
|
|
||||||
_pass=
|
|
||||||
for _part in $_pgt_user
|
|
||||||
do
|
|
||||||
if test -z "$_user"; then
|
|
||||||
_user=$_part
|
|
||||||
else
|
|
||||||
_pass=$_part
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
createuser "$_user"
|
|
||||||
__pgtests_passwd "$_user" "$_pass"
|
|
||||||
IFS=$save_IFS
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
for _pgt_db in $PGTESTS_DATABASES
|
|
||||||
do
|
|
||||||
save_IFS=$IFS
|
|
||||||
IFS=:
|
|
||||||
_db=
|
|
||||||
_user=
|
|
||||||
for _part in $_pgt_db
|
|
||||||
do
|
|
||||||
if test -z "$_user"; then
|
|
||||||
_user=$_part
|
|
||||||
else
|
|
||||||
_db=$_part
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
createdb "$_db" --owner "$_part"
|
|
||||||
|
|
||||||
IFS=$save_IFS
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__clean_trap_action ()
|
|
||||||
{
|
|
||||||
__new_actions=
|
|
||||||
for __action in $__TRAP_ACTIONS
|
|
||||||
do
|
|
||||||
if test "$__action" = "$1"; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
__new_actions="$__action $__new_actions"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
__TRAP_ACTIONS=$__new_actions
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pgtests_cleanup ()
|
|
||||||
{
|
|
||||||
if $PGTESTS_CLEANUP && $PGTESTS_AUTOSTOP; then
|
|
||||||
rm -r "$PGTESTS_DATADIR"
|
|
||||||
fi
|
|
||||||
__clean_trap_action pgtests_cleanup
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pgtests_stop ()
|
|
||||||
{
|
|
||||||
if $PGTESTS_AUTOSTOP; then
|
|
||||||
pg_ctl stop -D "$PGTESTS_DATADIR" -w
|
|
||||||
fi
|
|
||||||
__clean_trap_action pgtests_stop
|
|
||||||
}
|
|
@ -47,12 +47,11 @@
|
|||||||
Summary: JDBC driver for PostgreSQL
|
Summary: JDBC driver for PostgreSQL
|
||||||
Name: postgresql-jdbc
|
Name: postgresql-jdbc
|
||||||
Version: %upstreammajor.%{upstreamrel}
|
Version: %upstreammajor.%{upstreamrel}
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: http://jdbc.postgresql.org/
|
URL: http://jdbc.postgresql.org/
|
||||||
|
|
||||||
Source0: https://github.com/pgjdbc/pgjdbc/archive/REL%version.tar.gz
|
Source0: https://github.com/pgjdbc/pgjdbc/archive/REL%version.tar.gz
|
||||||
Source1: postgres-testing.sh
|
|
||||||
|
|
||||||
# Upstream moved parent pom.xml into separate project (even though there is only
|
# Upstream moved parent pom.xml into separate project (even though there is only
|
||||||
# one dependant project on it?). Let's try to not complicate packaging by
|
# one dependant project on it?). Let's try to not complicate packaging by
|
||||||
@ -69,8 +68,9 @@ BuildRequires: maven-plugin-bundle
|
|||||||
BuildRequires: maven-plugin-build-helper
|
BuildRequires: maven-plugin-build-helper
|
||||||
|
|
||||||
%if %runselftest
|
%if %runselftest
|
||||||
BuildRequires: postgresql-server
|
|
||||||
BuildRequires: postgresql-contrib
|
BuildRequires: postgresql-contrib
|
||||||
|
BuildRequires: postgresql-devel
|
||||||
|
BuildRequires: postgresql-server
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# gettext is only needed if we try to update translations
|
# gettext is only needed if we try to update translations
|
||||||
@ -138,7 +138,7 @@ mkdir -p pgjdbc/target/generated-sources/annotations
|
|||||||
|
|
||||||
# Include PostgreSQL testing methods and variables.
|
# Include PostgreSQL testing methods and variables.
|
||||||
%if %runselftest
|
%if %runselftest
|
||||||
. %{SOURCE1}
|
%pgtests_init
|
||||||
|
|
||||||
PGTESTS_LOCALE=C.UTF-8
|
PGTESTS_LOCALE=C.UTF-8
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ protocolVersion=0
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Start the local PG cluster.
|
# Start the local PG cluster.
|
||||||
pgtests_start
|
%pgtests_start
|
||||||
%else
|
%else
|
||||||
# -f is equal to -Dmaven.test.skip=true
|
# -f is equal to -Dmaven.test.skip=true
|
||||||
opts="-f"
|
opts="-f"
|
||||||
@ -184,6 +184,9 @@ opts="-f"
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 04 2016 Pavel Raiskup <praiskup@redhat.com> - 9.4.1210-2
|
||||||
|
- depend on test macros from postgresql-setup
|
||||||
|
|
||||||
* Thu Sep 08 2016 Pavel Raiskup <praiskup@redhat.com> - 9.4.1210-1
|
* Thu Sep 08 2016 Pavel Raiskup <praiskup@redhat.com> - 9.4.1210-1
|
||||||
- new release, rhbz#1374106, per announcement:
|
- new release, rhbz#1374106, per announcement:
|
||||||
https://www.postgresql.org/message-id/CAB=Je-FzuqwDXLTT62VfzvTUhR4QTfLjmw2D5QfgaykDkhW7nw@mail.gmail.com
|
https://www.postgresql.org/message-id/CAB=Je-FzuqwDXLTT62VfzvTUhR4QTfLjmw2D5QfgaykDkhW7nw@mail.gmail.com
|
||||||
|
Loading…
Reference in New Issue
Block a user