Files
micro-config-drive/tests/fetch_test
T
Brett T. Warden f9541b63ad Compare fetch test output with diff instead of cmp
...so we can see more clearly in the test logs what's different.
2022-11-04 10:40:55 -07:00

24 lines
543 B
Bash
Executable File

#!/bin/bash -x
set -euo pipefail
SCRIPT_PATH="$(dirname "$(readlink -f "${BASH_SOURCE}")")"
# Launch a lightweight HTTP server and attempt to fetch cloud config from it
# Uses the "test" template in ucd-fetch-data
cd "${SCRIPT_PATH}/fetch_data"
python -m http.server 8123 --bind 127.0.0.254 &
HTTP_PID=$!
trap "sleep 1; kill ${HTTP_PID}" EXIT
cd "${SCRIPT_PATH}"
sleep 2
../ucd-data-fetch test
# Compare what we got/generated with what we expect
diff -y fetch_data/expected test-user-data
# Cleanup the test data file
rm test-user-data