#!/bin/sh
# amulecmd starts and handles a missing core. Nothing listens on port 1 of the
# loopback, so the connection fails at once and nothing leaves the machine.
set -eu

export HOME="${AUTOPKGTEST_TMP:-$(mktemp -d)}"

out=$(timeout 60 amulecmd -h 127.0.0.1 -p 1 -P unused -c status 2>&1) || true
echo "$out"
case "$out" in
*"Connection Failed"*) ;;
*) echo "FAIL: amulecmd did not report the failed connection"; exit 1 ;;
esac
