diff options
Diffstat (limited to 'debian/tests/pacemaker-basic-resource.sh')
-rwxr-xr-x | debian/tests/pacemaker-basic-resource.sh | 98 |
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 |