| 1 |
#!/bin/bash |
| 2 |
set -euo pipefail |
| 3 |
source util/read_serial.sh |
| 4 |
|
| 5 |
echo 'Running cloud-init userdata test' |
| 6 |
|
| 7 |
echo 'Reading from serial port' |
| 8 |
SERIAL_OUTPUT=$(read_serial $1 $2) |
| 9 |
|
| 10 |
# check whether ./data/cloud-init-config.yaml is executed, will print "user-data in metadata executed" |
| 11 |
# in serial console if it was executed |
| 12 |
if echo $SERIAL_OUTPUT | grep -q 'user-data in metadata executed' |
| 13 |
then |
| 14 |
echo 'TEST FAILED: user-data executed on the VM' |
| 15 |
echo 'TEST FAILED.' > /workspace/status.txt |
| 16 |
else |
| 17 |
echo 'user-data not executed on the VM' |
| 18 |
fi |