summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:48:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:48:40 +0000
commitae09e15ef846b4b5b7664f375d31a2e635585aa6 (patch)
tree229bb55c1647dfa88110e88139294c1131b8e5c6 /debian/tests
parentAdding upstream version 200+deb10u5. (diff)
downloadpostgresql-common-ae09e15ef846b4b5b7664f375d31a2e635585aa6.tar.xz
postgresql-common-ae09e15ef846b4b5b7664f375d31a2e635585aa6.zip
Adding debian version 200+deb10u5.debian/200+deb10u5debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/control3
-rwxr-xr-xdebian/tests/default-psql19
2 files changed, 22 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..a59de84
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: default-psql
+Depends: postgresql
+Restrictions: needs-root
diff --git a/debian/tests/default-psql b/debian/tests/default-psql
new file mode 100755
index 0000000..3392ea4
--- /dev/null
+++ b/debian/tests/default-psql
@@ -0,0 +1,19 @@
+#!/bin/sh
+# autopkgtest to check that installing the "postgresql" metapackage results in
+# a working cluster
+set -e
+
+# disabled default cluster creation?
+if grep -q '\bcreate_main_cluster\b.*\bfalse\b' /etc/postgresql-common/createcluster.conf; then
+ echo "SKIP: default cluster creation disabled in createcluster.conf"
+ exit 0
+fi
+
+if ! pg_lsclusters | grep -q 'main .* online'; then
+ echo "No running cluster!" >&2
+ pg_lsclusters >&2
+fi
+
+# check that we can connect to template1 on the default cluster
+OUT=$(su - -c 'psql -Atc "select 21*2" template1' postgres)
+[ "$OUT" = "42" ] || { echo "$OUT"; exit 1; }