Developing dep8 tests with LXC

Robie Basak robie.basak at ubuntu.com
Wed Jul 3 09:53:38 UTC 2013


I scratched an itch and implemented an adt-virt-lxc, as I couldn't find
that anybody else had worked on it.

It's here: https://code.launchpad.net/~racb/ubuntu/saucy/autopkgtest/lxc
Or just grab the adt-virt-lxc binary from it, and run:
    autopkgtest (...) --- /path/to/downloaded/adt-virt-lxc saucy -s daily

It uses the ubuntu-cloud LXC template. It assumes that you have
permission to "sudo lxc-{create,start,attach,stop,destroy}" which works
fine on cloud images.


I was developing tests by writing them, testing manually, and then using
autopkgtest with adt-virt-schroot against the source tree.

But for server packages, this doesn't work so well, because we want to
test daemons that don't play nicely with an schroot.

So LXC seemed like a good solution. Now I can write tests for daemons
more easily.


A couple of issues with my code, which I'd like to fix with some
feedback:

1. I currently hardcode the container name "test". How do I create a
unique new container name without racing to create it? A question for
Serge perhaps?

2. How do I detect when the container is fully booted so that I can use
it? Using lxc-wait only gave me it from (I presume) the host's
perspective; the guest kept breaking things until I figured out that it
was cleaning /tmp after I had already started using it. For now, I've
got a sleep hack to avoid this. But how do I detect boot completion
properly? A question for Scott maybe?

Thanks,

Robie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-quality/attachments/20130703/316f26e4/attachment.pgp>


More information about the Ubuntu-quality mailing list