Juju Development Notes
Notes for hacking on Juju
Juju uses trial, the Twisted test runner. Its semantics are different from Zope's testrunner. To run a single test you must provide the full (pythonic) path to that test:
$ ./test the.path.to.the.TestCase.and_test
- There are some tests which will always fail if you don't have your EC2 credentials in your ENV. There's debate about whether these tests should be made to not depend on the ENV variables.
- The same tests look like they try to connect to EC2 but apparently don't. There's debate about whether they should or not.
Because juju is all Twisted, the tests run inside a reactor. This means that if you're debugging the reactor will swallow a CTRL-C and just report an error for every subsequent test. Upshot test narrowly when debugging.
Notes for working with Juju Charms
You can only pass in config options as strings to juju set. If you want to upload an entire config file, you need to do something like:
$ juju set my-service option=$(uuencode /path/to/config/file)
- juju debug-log is broken (well, juju-log on the units is broken, but the upshot is that it won't get reflected if you run juju debug-log on your local machine). Brad has a workaround:
(On the client) root@ip-10-116-73-15:/# grep unit.hook.api /var/lib/juju/units/$UNITNAME/charm.log 2012-01-17 20:51:17,315: unit.hook.api@INFO: --> install 2012-01-17 20:51:20,588: unit.hook.api@INFO: Creating master in /tmp/buildbot 2012-01-17 20:51:23,539: unit.hook.api@INFO: <-- install 2012-01-17 20:51:24,883: unit.hook.api@INFO: --> config-changed 2012-01-17 20:51:25,561: unit.hook.api@INFO: Updating buildbot configuration. 2012-01-17 20:51:26,811: unit.hook.api@INFO: Config decoded and written. 2012-01-17 20:51:27,406: unit.hook.api@INFO: <-- config-changed 2012-01-17 20:51:28,793: unit.hook.api@INFO: --> start 2012-01-17 20:51:30,613: unit.hook.api@DEBUG: opened 8010/tcp 2012-01-17 20:51:31,258: unit.hook.api@INFO: <-- start
- The order of hooks on startup is as follows:
- install
- config-changed
- start
- As a result, config-changed hooks shouldn't assume that a service has been started; they should check before restarting it.