I've taken a tiny step towards getting together a prototype toolset for developing an initial development iteration of the NAS functionality of the FreedomBox.

Here's what I am trying to do:

  • create a disk image for a system that provides simplistic NAS functionality, with no configuration, including no authentication: just serve whatever disks are available over SMB
  • use a TDD approach to developing it

In essence, this means I want to specify the functionality of the system I am building using automated tests. As soon as those tests pass, I will write more tests, and make them pass. When I can't think of new relevant tests, I know I'm done.

I'm building a simple tool, systest, that will execute the tests. It is built on top of Python's unittest library, because that makes my implementation simple.

I've now developed systest far enough that I can almost automatically do this:

  • build a new image, using vmdebootstrap, plus a customization script
  • start the image with KVM controlled by libvirt
  • run the tests using systest

(The command line would be something like this: ./build-fbxnas && virsh start fbxnas && sleep 30 && ~/systest/systest --target=192.168.122.89 --user=tomjon ~/systest/tests-debian-base-install.py --user-ssh-private-key=tomjon.secret --log=foo.log --user-password=password1 where build-fbxnas is a wrapper script around vmdebootstrap. But I didn't actually run that command, and it's lacking the virt-install command to actually set up the virtual machine the first time.)

systest contains very little code, but to get that far, I had to shave some yaks, and that made writing it rather an unpleasant experience.

The tests so far really simple, and don't test NAS stuff at all, just that the basic Debian install works: only the ssh port is open, and basic networking and such things work. However, now that I've gotten this much to work, I can start writing NAS tests. (smbclient may be my next yak. This would be a lot easier if I had ever used Samba for anything real...)

systest and vmdebootstrap are on Gitorious. No .debs yet, this stuff is much too raw, but you can run them from the checkouts, no install necessary.

PS. If anyone knows how to query KVM or libvirt for the IP address assigned by their internal DHCP server to the virtual machine guest, automatically, without asking the actual virtual machine, please tell.