#!/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
#!ipxe
iseq \${smbios/manufacturer} HP && exit ||
sanboot --no-describe --drive 0x80

EOF

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

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