summaryrefslogtreecommitdiffstats
path: root/debian/tests/pacemaker-basic-resource.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 06:49:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 06:49:00 +0000
commit93907d0c009d758811b54e7984337477a39f05cf (patch)
treea34881e1b02ccd5281ca58a799877f2d5e80d778 /debian/tests/pacemaker-basic-resource.sh
parentAdding upstream version 4.6.0. (diff)
downloadcrmsh-93907d0c009d758811b54e7984337477a39f05cf.tar.xz
crmsh-93907d0c009d758811b54e7984337477a39f05cf.zip
Adding debian version 4.6.0-1.debian/4.6.0-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/pacemaker-basic-resource.sh')
-rwxr-xr-xdebian/tests/pacemaker-basic-resource.sh98
1 files changed, 98 insertions, 0 deletions
diff --git a/debian/tests/pacemaker-basic-resource.sh b/debian/tests/pacemaker-basic-resource.sh
new file mode 100755
index 0000000..de2a4c4
--- /dev/null
+++ b/debian/tests/pacemaker-basic-resource.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+set -ex
+
+DAEMON_TIMEOUT=60
+CRM_TIMEOUT=5
+RSC_NAME="test"
+rsc_check()
+{
+ if crm status | grep "$RSC_NAME[[:space:]][(]ocf::\?heartbeat:IPv6addr[)]:[[:space:]].*$1" >/dev/null; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# https://bugs.launchpad.net/bugs/1828228
+ulimit -H -l unlimited 2>/dev/null || {
+ echo "test disabled for unprivileged namespaces"
+ exit 77
+}
+
+#
+# daemons start
+#
+
+service corosync start
+service pacemaker start
+sleep $DAEMON_TIMEOUT
+
+#
+# disable stonith and quorum
+#
+
+crm configure property stonith-enabled="false"
+crm configure property no-quorum-policy="ignore"
+sleep $CRM_TIMEOUT
+
+#
+# creation & start
+#
+
+crm configure primitive $RSC_NAME \
+ ocf:heartbeat:IPv6addr \
+ params ipv6addr="fe00::200" \
+ cidr_netmask="64" \
+ nic="lo"
+sleep $CRM_TIMEOUT
+crm resource start $RSC_NAME
+sleep $CRM_TIMEOUT
+if rsc_check "Started" ; then
+ : INFO resource creation and start OK
+else
+ : ERROR failed to start resource
+ exit 1
+fi
+
+#
+# restart
+#
+
+crm resource restart $RSC_NAME
+sleep $CRM_TIMEOUT
+if rsc_check "Started" ; then
+ : INFO resource restart OK
+else
+ : ERROR failed to restart resource
+ exit 1
+fi
+
+#
+# stop
+#
+
+crm resource stop $RSC_NAME
+sleep $CRM_TIMEOUT
+if rsc_check "Stopped" ; then
+ : INFO resource stop OK
+else
+ : ERROR failed to stop resource
+ exit 1
+fi
+
+#
+# delete
+#
+
+crm configure delete $RSC_NAME
+sleep $CRM_TIMEOUT
+if ! rsc_check "Stopped" ; then
+ : INFO resource delete OK
+else
+ : ERROR failed to delete resource
+ exit 1
+fi
+
+: INFO all tests OK
+exit 0