Charm verification

Jelmer Vernooij jelmer at
Fri Dec 23 14:25:46 UTC 2011

Hi Gustavo,

On 12/23/2011 01:30 PM, Gustavo Niemeyer wrote:
>> Over the last couple of days I've been experimenting with charms a bit,
>> and I am really liking it so far. It was especially surprising to see
>> how quick I got from a plain precise install to getting a newly written
>> charm deployed.
> Neat! What have you been deploying there?
So far I've got working charms for BitlBee and Loggerhead. They're both
really simple network services, and thus obvious candidates for a first

Over the holidays I hope to get the Samba 4 Active Directory DC in a
charm working. Being able to have an easily scalable Windows domain
would be really nice (I don't think that's even possible with Windows
Server). That's probably going to be more challenging.. :-)

>> I found myself writing simple test scripts for each charm, to verify
>> that the service unit was operating properly. In my case this sped up
>> development of the charm, since it meant not having to fire up a network
>> client manually, but just running a script. Perhaps it would also be
>> useful to verify that a particular unit is still working properly? I
>> guess in many ways it would be akin to a nagios plugin, but one which
>> pulls its configuration out of juju - so doesn't need any further
>> configuration.
> One of the things I still have in my table from UDS is to design a
> testing framework for charms, but it's not entirely clear that this is
> really what you're alluding to here. What kind of script do you have
> in mind?
I should warn you that it's a bit of a hack...

What the script for BitlBee does:

* parses the output of "juju status" and "juju get" to find the relevant
address/port for the specified service/unit
* connect to the server and run a few basic tests to see that it's up
and not completely broken
* writes out OK or FAIL and sets the appropriate exit code

in other words:

$ ./verify bitlbee/0

This works for bitlbee because the port is in the configuration. I guess
in an ideal world it would actually join/leave the chat-server relation
and obtain the host/port for the irc interface. I couldn't work out how
to do that in a couple of lines of Python code though.

So it's more akin to a nagios check than a testsuite at the moment.
There is probably some overlap, but they seem to be different things. My
script won't change the active configuration and could be run against
something that is in production - I imagine a testsuite would tweak the
configuration. I'm very interested in testsuites as well though.



More information about the Juju mailing list