#!/bin/sh
set -e

check_out() {
    echo "$OUT" | grep -q "$1" || {
        echo "output does not match '$1'" >&2
        exit 1
    }
}

echo " * bridge works and has expected packages"
OUT=$(cockpit-bridge --packages)
echo "$OUT"
check_out "^base1: /usr/share/cockpit/base1"
check_out "^system:"
check_out "^dashboard:"

echo " * socket unit is set up correctly, login page available"
OUT=$(curl --silent --insecure https://localhost:9090)
check_out "login-user-input.*User"
