#!/bin/sh

set -e

# Corosync did not start if the test container is unprivileged
if ! ulimit -H -l unlimited 2>/dev/null; then
  printf 'system.allow_knet_handle_fallback: yes\n' >>/etc/corosync/corosync.conf
fi

cleanup () {
  service pacemaker stop
  service corosync stop
}

trap "cleanup" 0 2 3 15

service corosync start
service pacemaker start

sleep 60

pcs cluster status | grep -20 -E '0 resource( instance)?s configured'
