Hello all,
first, a quick intro of myself: I'm Martin Pitt (nicknamed "pitti" on IRC and IRL) and joined Red Hat's Cockpit team yesterday. Until then I've been a Debian developer for about 14 years and an Ubuntu developer for about 12½. I've touched a lot of things over the years, but most recently I've mostly been involved in plumbing (systemd, networking, udisks and the like) and Ubuntu's CI.
While learning about cockpit and how to test it I put together a small script [1] that creates a Fedora 25 based Cockpit development VM out of thin air (using mkosi). This contains a running cockpit (as it comes with F25) as well as all build and test dependencies. This helped me personally to figure out some issues with setting up the tests (like [2]), gives me a tool to get a reproducible dev environment without cluttering my host system with lots of build/test depends, and I can use QEMU's snapshots to reset to a clean state. Stef mentioned that this might also be useful for improving our isolation in GitHub's integration tests.
How does it look like? You call it with the output VM path and cockpit's git checkout directory as arguments, it will do some grinding and eventually give you some info how to use it:
| $ ~/cockpit-dev-vm.sh /srv/vm/cockpit.img ~/upstream/cockpit | [...] | Run the VM (possibly with appending "-snapshot"): | | qemu-system-x86_64 -enable-kvm -cpu host -nographic -m 6144 -bios /usr/share/edk2/ovmf/OVMF_CODE.fd \ | -virtfs local,id=src,path=.,security_model=none,mount_tag=src,readonly \ | -net nic,model=virtio -net user,hostfwd=tcp::22000-:22,hostfwd=tcp::9099-:9090 /srv/vm/cockpit.img | | Cockpit: https://localhost:9099 | SSH: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no -p 22000 test@localhost | (password "test") | | Read-only view of . is at /src
After booting the VM and ssh'ing in, you can copy the read-only view of outside cockpit tree to writable place:
| cp -a /src cockpit | cd cockpit
... and run some integration test:
| $ sudo test/vm-prep | $ test/verify/testsuite-prepare | # the following is a bug [2], PR is pending | $ npm install phantomjs-prebuilt | | $ test/verify/check-login
The binding of the outside checkout dir is useful so that the VM doesn't have to re-download the large test VMs, and you don't need to spend so much VM disk space on them. I'm not too happy about the read-only /src yet, I'll see if it's feasible to automatically set up an overlayfs for ~test/cockpit instead.
Note that the VM gets 6 GiB of RAM, as some of its inner VMs are quite large. So you need sufficient RAM on your host. Also note that this requires booting with "kvm-intel.nested=1" option on the kernel command line -- while /etc/modprobe.d/kvm-intel.conf apparently intends to supply that option, it doesn't work at least in F25.
Maybe this is useful for someone/something else, please let me know if you have ideas for improvements.
Thanks,
Martin
[1] http://www.piware.de/tools/cockpit-dev-vm [2] https://github.com/cockpit-project/cockpit/issues/5676