summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/control14
-rwxr-xr-xdebian/tests/ipctest5
-rwxr-xr-xdebian/tests/logd47
-rwxr-xr-xdebian/tests/stonith-null16
-rwxr-xr-xdebian/tests/stonith-suicide22
-rwxr-xr-xdebian/tests/user5
6 files changed, 109 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..8ee5a30
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,14 @@
+Depends: cluster-glue
+Tests: user, ipctest
+
+Depends: cluster-glue, rsyslog
+Restrictions: needs-root
+Tests: logd
+
+Depends: cluster-glue
+Restrictions: needs-root
+Tests: stonith-null
+
+Depends: cluster-glue
+Restrictions: needs-root, isolation-machine
+Tests: stonith-suicide
diff --git a/debian/tests/ipctest b/debian/tests/ipctest
new file mode 100755
index 0000000..df48cf6
--- /dev/null
+++ b/debian/tests/ipctest
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+/usr/lib/heartbeat/ipctest 2>&1
diff --git a/debian/tests/logd b/debian/tests/logd
new file mode 100755
index 0000000..6ef5f05
--- /dev/null
+++ b/debian/tests/logd
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+LOG=/var/log/syslog
+
+log_checker() {
+ if [ -f $LOG ]; then
+ grep "$1" $LOG && return 0
+ else
+ journalctl -u logd.service --grep "$1" && return 0
+ fi
+ return 1
+}
+
+check_log() {
+ for i in 1 2 3 4 5; do
+ log_checker "$1" && return 0
+ sleep 1
+ done
+ return 1
+}
+
+echo "=== service ==="
+service logd restart # connect to rsyslog after it is installed
+service logd status || ERR="$ERR service"
+
+echo "=== ha_logger ==="
+for i in 1 2 3 4 5; do # logd might not be available right away
+ ha_logger autopkgtest-message 2>&1 && break
+ sleep 1
+done
+check_log 'autopkgtest-message' || ERR="$ERR ha_logger"
+
+echo "=== logtest ==="
+/usr/lib/heartbeat/logtest 10 2>&1 || true
+check_log 'total message dropped: 0' || ERR="$ERR logtest"
+
+if [ "$ERR" ]; then
+ if [ -f $LOG ]; then
+ tail -n 20 $LOG
+ else
+ journalctl -u logd.service -n 20
+ fi
+ echo "Failed checks:$ERR"
+ exit 1
+fi
diff --git a/debian/tests/stonith-null b/debian/tests/stonith-null
new file mode 100755
index 0000000..cecf8e9
--- /dev/null
+++ b/debian/tests/stonith-null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+HOSTNAME=$(hostname)
+
+echo "=== list ==="
+stonith -L
+
+printf "\n=== metadata ===\n"
+stonith -t null -m
+
+printf "\n=== status ===\n"
+stonith -d -t null hostlist=$HOSTNAME -S -l 2>&1
+
+printf "\n=== reset ===\n"
+stonith -d -t null hostlist=$HOSTNAME -T reset $HOSTNAME 2>&1
diff --git a/debian/tests/stonith-suicide b/debian/tests/stonith-suicide
new file mode 100755
index 0000000..616d362
--- /dev/null
+++ b/debian/tests/stonith-suicide
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+if [ "$AUTOPKGTEST_REBOOT_MARK" = fenced ]; then
+ echo "fence was successfull"
+ exit 0
+fi
+
+echo "=== list ==="
+stonith -L
+
+printf "\n=== metadata ===\n"
+stonith -t suicide -m
+
+printf "\n=== status ===\n"
+stonith -d -t suicide -S -l 2>&1
+
+printf "\n=== reset ===\n"
+/tmp/autopkgtest-reboot-prepare fenced
+sync
+stonith -d -t suicide -T reset $(hostname)
diff --git a/debian/tests/user b/debian/tests/user
new file mode 100755
index 0000000..ca723ff
--- /dev/null
+++ b/debian/tests/user
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+id hacluster | grep haclient