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

source ${SYSTESTS_PRELUDE} && prepare

set -x -e -o pipefail

# Arrange
cobbler image add --name=fakeimage
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 --image fakeimage
# Prepare expected result
cat >${tmp}/a <<-EOF
:fake
kernel /images/fake/vmlinuz   initrd=initrd.magic
initrd /images/fake/initramfs
boot

EOF

# Act
curl --output ${tmp}/b http://localhost/cblr/svc/op/ipxe/profile/fake

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