#!/bin/sh # autopkgtest: Run service and tests binding set -eu output="$(mktemp)" diagnostics="$(mktemp)" cleanup() { status=$? trap - 0 /etc/init.d/shoelaces stop || true rm -f "$output" "$diagnostics" exit "$status" } trap cleanup 0 /etc/init.d/shoelaces start /etc/init.d/shoelaces status if ! wget \ --content-on-error \ --output-document="$output" \ --retry-connrefused \ --server-response \ --timeout=10 \ --tries=5 \ http://127.0.0.1:8081/ \ 2>"$diagnostics" then echo "Shoelaces did not return a successful HTTP response" >&2 if [ -s "$diagnostics" ]; then echo "wget diagnostics:" >&2 cat "$diagnostics" >&2 fi if [ -s "$output" ]; then echo "Response body:" >&2 cat "$output" >&2 fi /etc/init.d/shoelaces status || true if command -v journalctl >/dev/null; then journalctl --no-pager --unit=shoelaces.service --lines=100 || true fi exit 1 fi echo "Shoelaces returned a successful HTTP response"