[Maas-devel] [Merge] lp:~jtv/maas/db-fixture into lp:maas

Jeroen T. Vermeulen jtv at canonical.com
Tue Jan 17 16:57:36 UTC 2012


Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/db-fixture into lp:maas.

Requested reviews:
  MaaS Developers (maas-devel)

For more details, see:
https://code.launchpad.net/~jtv/maas/db-fixture/+merge/88898

Set up the testing database cluster as part of the test runner.

It took me a while to find a hook into the test runner that I could use.  The one I found was: use a custom test runner based on the django one, but with a call to maasdb added to it.  I couldn't define the custom runner in development.py or maas/__init__.py etc. because it'd just lead to circular imports and a mysterious failure.

To try this out, create a new branch (so there's certainly no database cluster running in it), "make," then check "ps -ef | grep postgres" to verify that there still is no postgres running in the branch, then "./bin/test" to see that the tests can access the database.  I added some only-slightly-more-meaningful tests to make sure of that.

You may notice that database setup before a test takes a while.  That doesn't go away when I remove the custom test runner though; I guess it's something we just can't get rid of.

Something a bit nasty I did was to hard-code "./db/" as the database cluster location.  Ideally I'd have some way of specifying "main branch directory/db."

The maasdb script does nothing when asked to start a cluster that's already running.  Doesn't take very long to find out, either.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/db-fixture/+merge/88898
Your team MaaS Developers is requested to review the proposed merge of lp:~jtv/maas/db-fixture into lp:maas.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: review-diff.txt
Type: text/x-diff
Size: 2470 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/maas-devel/attachments/20120117/8b973e60/attachment.diff>


More information about the Maas-devel mailing list