support cloud-init tests for snappy via nocloud datasource
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
autopkgtest (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
We're wanting to get some automated tests of snappy and cloud-init's snappy support. This bug isn't a requeest for specific feature, but rather a way to accomplish that.
What I have is available at lp:~smoser/+junk/ud-snappy
Thats basically a set of user-datas that excercise cloud-init inside snappy.
To use that, I've been doing something like this:
## build a 'cloud' image (with no nocloud seed inside)
$ sudo ubuntu-device-flash --output=
--channel=
## create a 'disk.img' backed by the pristine 'ubuntu-core.img'
$ qemu-img create -f qcow2 -b ubuntu-core.img disk.img
## update the metadata.yaml file to have your ~/.ssh/id_rsa.pub for ssh access
## create a seed.img for one of the user-data.yaml files in the branch above
$ cloud-localds seed.img ud-sideload.yaml metadata.yaml
## boot the system in kvm, logging to a file.
$ qemu-system-x86_64 -enable-kvm disk.img seed.img \
-serial file:serial.log -m 768
$ ssh <system> and verify things listed in files
$ look at serial.log to see things expected.
The last 2 steps are manual, but we can certainly put shutdown in the
runcmd that we provide so that the system shuts itself off when it is
done.
Also we can put more runcmd in that assert that the expectations are
met inside the vm ('snappy list' and such) with logging to console, and
then just check the console after shutdown for the expected messages.