From 557e34b70c2f91f7dc788665130278e06ca2b957 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 22 May 2017 11:53:59 +0900 Subject: [PATCH] Add basic regression test from downstream Per GitHub #282 Ref: https://anonscm.debian.org/cgit/pkg-postgresql/repmgr.git/tree/debian/patches/regress.patch --- Makefile | 1 + expected/repmgr_funcs.out | 18 ++++++++++++++++++ expected/repmgr_test.out | 24 ++++++++++++++++++++++++ sql/repmgr_test.sql | 4 ++++ 4 files changed, 47 insertions(+) create mode 100644 expected/repmgr_funcs.out create mode 100644 expected/repmgr_test.out create mode 100644 sql/repmgr_test.sql diff --git a/Makefile b/Makefile index 64f7916b..a79ccf02 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ repmgrd_OBJS = dbutils.o config.o repmgrd.o log.o strutil.o repmgr_OBJS = dbutils.o check_dir.o config.o repmgr.o log.o strutil.o dirmod.o compat.o DATA = repmgr.sql uninstall_repmgr.sql +REGRESS = repmgr_funcs repmgr_test PG_CPPFLAGS = -I$(libpq_srcdir) PG_LIBS = $(libpq_pgport) diff --git a/expected/repmgr_funcs.out b/expected/repmgr_funcs.out new file mode 100644 index 00000000..70ec12cf --- /dev/null +++ b/expected/repmgr_funcs.out @@ -0,0 +1,18 @@ +/* + * repmgr_function.sql + * Copyright (c) 2ndQuadrant, 2010-2017 + * + */ +-- SET SEARCH_PATH TO 'repmgr'; +CREATE FUNCTION repmgr_update_standby_location(text) RETURNS boolean +AS '$libdir/repmgr_funcs', 'repmgr_update_standby_location' +LANGUAGE C STRICT; +CREATE FUNCTION repmgr_get_last_standby_location() RETURNS text +AS '$libdir/repmgr_funcs', 'repmgr_get_last_standby_location' +LANGUAGE C STRICT; +CREATE FUNCTION repmgr_update_last_updated() RETURNS TIMESTAMP WITH TIME ZONE +AS '$libdir/repmgr_funcs', 'repmgr_update_last_updated' +LANGUAGE C STRICT; +CREATE FUNCTION repmgr_get_last_updated() RETURNS TIMESTAMP WITH TIME ZONE +AS '$libdir/repmgr_funcs', 'repmgr_get_last_updated' +LANGUAGE C STRICT; diff --git a/expected/repmgr_test.out b/expected/repmgr_test.out new file mode 100644 index 00000000..408bf1e0 --- /dev/null +++ b/expected/repmgr_test.out @@ -0,0 +1,24 @@ +select * from repmgr_update_standby_location(''); + repmgr_update_standby_location +-------------------------------- + f +(1 row) + +select * from repmgr_get_last_standby_location(); + repmgr_get_last_standby_location +---------------------------------- + +(1 row) + +select * from repmgr_update_last_updated(); + repmgr_update_last_updated +---------------------------- + +(1 row) + +select * from repmgr_get_last_updated(); + repmgr_get_last_updated +------------------------- + +(1 row) + diff --git a/sql/repmgr_test.sql b/sql/repmgr_test.sql new file mode 100644 index 00000000..fd7f2717 --- /dev/null +++ b/sql/repmgr_test.sql @@ -0,0 +1,4 @@ +select * from repmgr_update_standby_location(''); +select * from repmgr_get_last_standby_location(); +select * from repmgr_update_last_updated(); +select * from repmgr_get_last_updated();