#!/usr/bin/env bash
# Check that the Cobbler HTTP endpoint /autoinstall/ is callable

source ${SYSTESTS_PRELUDE} && prepare

set -x -e -o pipefail

# Arrange
cobbler distro add --name fake --arch x86_64 --kernel ${fake_kernel} \
	--initrd ${fake_initramfs}
cobbler profile add --name fake --distro fake
cobbler system add --name testbed --profile fake
# Prepare expected result
cat >${tmp}/a <<-EOF
# this file intentionally left blank
# admins:  edit it as you like, or leave it blank for non-interactive install
EOF

# Act
curl --output ${tmp}/b http://localhost/cblr/svc/op/autoinstall/system/testbed
curl --output ${tmp}/c http://localhost/cblr/svc/op/autoinstall/profile/fake

# Assert
diff ${tmp}/{a,b}
diff ${tmp}/{a,c}