summaryrefslogtreecommitdiffstats
path: root/debian/tests/pacemaker-node-status.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-node-status.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 '')
-rwxr-xr-xdebian/tests/pacemaker-node-status.sh76
1 files changed, 76 insertions, 0 deletions
diff --git a/debian/tests/pacemaker-node-status.sh b/debian/tests/pacemaker-node-status.sh
new file mode 100755
index 0000000..a0a2fbc
--- /dev/null
+++ b/debian/tests/pacemaker-node-status.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+set -ex
+
+DAEMON_TIMEOUT=60
+CRM_TIMEOUT=5
+
+# 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
+
+# Get the node name as sugested in
+# https://lists.clusterlabs.org/pipermail/users/2022-May/030309.html
+NODE="$(crm_node -n)"
+if [ -z "$NODE" ]; then
+ echo "Could not detect node name"
+ exit 1
+fi
+# crmsh will try to ping the node name so make sure it can be resolved
+if ! getent hosts "$NODE" >/dev/null 2>&1; then
+ echo "127.0.0.1 $NODE" >> /etc/hosts
+fi
+
+#
+# online
+#
+
+crm status | grep "Online:.*$NODE"
+
+#
+# standby
+#
+
+crm node standby $NODE
+sleep $CRM_TIMEOUT
+crm status | grep "Node $NODE: standby"
+
+crm node online $NODE
+sleep $CRM_TIMEOUT
+crm status | grep "Online:.*$NODE"
+
+#
+# maintenance
+#
+
+crm node maintenance $NODE
+sleep $CRM_TIMEOUT
+crm status | grep "Node $NODE: maintenance"
+
+crm node ready $NODE
+sleep $CRM_TIMEOUT
+crm status | grep "Online:.*$NODE"
+
+#
+# attributes
+#
+
+crm node attribute $NODE set memory_size 1024
+crm node attribute $NODE show memory_size | grep 1024
+crm node utilization $NODE set memory 2048
+crm node utilization $NODE show memory | grep 2048
+crm node server
+crm node show
+
+: INFO all tests OK
+exit 0