On Wed, Jun 18, 2008 at 12:06 PM, Ash Berlin <[EMAIL PROTECTED]> wrote: > On 18 Jun 2008, at 11:38, Ovid wrote: > >> Hi all, >> >> Pursuant to an idea I've outlined in >> http://use.perl.org/~Ovid/journal/36711, we're looking at caching some >> of our test fixtures. While some might *require* being generated >> dynamically, many of our fixtures are in the following form: >> >> Or is there a much easier way of going about this? >> > > First thing I'd suggest is to look at DBIx::Class::Fixtures and see how > close it comes to your needs. (I'm guessing you haven't looked at it yet > judging by your useperl post)
The second thing you'll want to look at after checking out D::C::Fixtures is dumping the resulting fixture data in whatever native format your database handles and importing that in your tests. In my case (I'm running Postgres), I ended up with several thousand individual fixture files which took an enormous amount of time to process because of all the extra IO. Enough that it made running tests prohibitive. So what I did was modify my dumping procedure to do this: do a dump of the data I want from the source database using D::C::Fixtures::dump(), then import the resulting fixtures into my test database with populate(). Finally I run pg_dump on the test database and save that to a file. When I want to repopulate the test database, then it only takes 10 seconds instead of 60+ seconds because I'm importing my pg_dump file rather than then 3k+ individual fixtures files. Luke and I have discussed briefly how we can encapsulate this behavior, but we haven't gone further than that. Patches & ideas welcome! :-) Drew -- ---------------------------------------------------------------- Drew Taylor * Web development & consulting Email: [EMAIL PROTECTED] * Site implementation & hosting Web : www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres ---------------------------------------------------------------- _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
