Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Catalyst::Test & Test::DBIx::Class

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


lists at eightdegrees

Dec 3, 2011, 7:56 PM

Post #1 of 7 (531 views)
Permalink
Catalyst::Test & Test::DBIx::Class

Dear lazyweb..

not sure if this is staring me in the face..

If I'm using Catalyst::Test & Test::DBIx::Class, with the latter starting
up MySQL with a random socket location, how do I tell my Catalyst server
how to connect to the MySQL instance? I'm also trying to get my tests
running in parallel so I don't want to pre-set anything..

cheers,

J


lists at eightdegrees

Dec 3, 2011, 8:13 PM

Post #2 of 7 (524 views)
Permalink
Re: Catalyst::Test & Test::DBIx::Class [In reply to]

hmm.. actually.. can I hand Catalyst::Test the schema I can get
from Test::DBIx::Class?

On Sun, Dec 4, 2011 at 1:56 PM, Jason Galea <lists [at] eightdegrees>wrote:

> Dear lazyweb..
>
> not sure if this is staring me in the face..
>
> If I'm using Catalyst::Test & Test::DBIx::Class, with the latter starting
> up MySQL with a random socket location, how do I tell my Catalyst server
> how to connect to the MySQL instance? I'm also trying to get my tests
> running in parallel so I don't want to pre-set anything..
>
> cheers,
>
> J
>
>


bobtfish at bobtfish

Dec 4, 2011, 1:10 AM

Post #3 of 7 (512 views)
Permalink
Re: Re: Catalyst::Test & Test::DBIx::Class [In reply to]

On 4 Dec 2011, at 04:13, Jason Galea wrote:

> hmm.. actually.. can I hand Catalyst::Test the schema I can get from
> Test::DBIx::Class?

I think you can just force replace the schema, with something like
MyApp->model('DB')->schema($mytestschema);

Alternatively, you can setup a test config (by writing out a config
file with the extra DB details in) before using Catalyst::Test
(although N.B. that use Catalyst::Test will happen at compile time, so
you probably need the initial setup in a BEGIN block).

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


lists at eightdegrees

Dec 4, 2011, 1:35 AM

Post #4 of 7 (517 views)
Permalink
Re: Re: Catalyst::Test & Test::DBIx::Class [In reply to]

ok cool.

thanks, t0m.

On Sun, Dec 4, 2011 at 7:10 PM, Tomas Doran <bobtfish [at] bobtfish> wrote:

>
> On 4 Dec 2011, at 04:13, Jason Galea wrote:
>
> hmm.. actually.. can I hand Catalyst::Test the schema I can get from
>> Test::DBIx::Class?
>>
>
> I think you can just force replace the schema, with something like
> MyApp->model('DB')->schema($**mytestschema);
>
> Alternatively, you can setup a test config (by writing out a config file
> with the extra DB details in) before using Catalyst::Test (although N.B.
> that use Catalyst::Test will happen at compile time, so you probably need
> the initial setup in a BEGIN block).
>
> Cheers
> t0m
>
>
> ______________________________**_________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalyst<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>
> Searchable archive: http://www.mail-archive.com/**
> catalyst [at] lists/<http://www.mail-archive.com/catalyst [at] lists/>
> Dev site: http://dev.catalyst.perl.org/
>


lists at eightdegrees

Dec 4, 2011, 1:49 AM

Post #5 of 7 (514 views)
Permalink
Re: Re: Catalyst::Test & Test::DBIx::Class [In reply to]

>
> On Sun, Dec 4, 2011 at 7:10 PM, Tomas Doran <bobtfish [at] bobtfish> wrote:
>
>>
>> On 4 Dec 2011, at 04:13, Jason Galea wrote:
>>
>> hmm.. actually.. can I hand Catalyst::Test the schema I can get from
>>> Test::DBIx::Class?
>>>
>>
>> I think you can just force replace the schema, with something like
>> MyApp->model('DB')->schema($**mytestschema);
>>
>
yup, works a treat.. thanks again.

$ prove t
...
All tests successful.
Files=6, Tests=90, 27 wallclock secs ( 0.07 usr 0.02 sys + 9.87 cusr
1.14 csys = 11.10 CPU)

Result: PASS

$ prove -j9 t
...
All tests successful.
Files=6, Tests=90, 8 wallclock secs ( 0.06 usr 0.01 sys + 11.24 cusr
1.34 csys = 12.65 CPU)

Result: PASS

woohoo!




>
>> Alternatively, you can setup a test config (by writing out a config file
>> with the extra DB details in) before using Catalyst::Test (although N.B.
>> that use Catalyst::Test will happen at compile time, so you probably need
>> the initial setup in a BEGIN block).
>>
>> Cheers
>> t0m
>>
>>
>> ______________________________**_________________
>> List: Catalyst [at] lists
>> Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalyst<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>
>> Searchable archive: http://www.mail-archive.com/**
>> catalyst [at] lists/<http://www.mail-archive.com/catalyst [at] lists/>
>> Dev site: http://dev.catalyst.perl.org/
>>
>
>


mitakaa at gmail

Dec 4, 2011, 1:59 AM

Post #6 of 7 (516 views)
Permalink
Re: Re: Catalyst::Test & Test::DBIx::Class [In reply to]

You might want to check this blog post also:
http://www.modernperlbooks.com/mt/2011/11/parallelism-and-test-suites.html

Cheers

On Sun, Dec 4, 2011 at 10:49 AM, Jason Galea <lists [at] eightdegrees>wrote:

> On Sun, Dec 4, 2011 at 7:10 PM, Tomas Doran <bobtfish [at] bobtfish> wrote:
>>
>>>
>>> On 4 Dec 2011, at 04:13, Jason Galea wrote:
>>>
>>> hmm.. actually.. can I hand Catalyst::Test the schema I can get from
>>>> Test::DBIx::Class?
>>>>
>>>
>>> I think you can just force replace the schema, with something like
>>> MyApp->model('DB')->schema($**mytestschema);
>>>
>>
> yup, works a treat.. thanks again.
>
> $ prove t
> ...
> All tests successful.
> Files=6, Tests=90, 27 wallclock secs ( 0.07 usr 0.02 sys + 9.87 cusr
> 1.14 csys = 11.10 CPU)
>
> Result: PASS
>
> $ prove -j9 t
> ...
> All tests successful.
> Files=6, Tests=90, 8 wallclock secs ( 0.06 usr 0.01 sys + 11.24 cusr
> 1.34 csys = 12.65 CPU)
>
> Result: PASS
>
> woohoo!
>
>
>
>
>>
>>> Alternatively, you can setup a test config (by writing out a config file
>>> with the extra DB details in) before using Catalyst::Test (although N.B.
>>> that use Catalyst::Test will happen at compile time, so you probably need
>>> the initial setup in a BEGIN block).
>>>
>>> Cheers
>>> t0m
>>>
>>>
>>> ______________________________**_________________
>>> List: Catalyst [at] lists
>>> Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalyst<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>
>>> Searchable archive: http://www.mail-archive.com/**
>>> catalyst [at] lists/<http://www.mail-archive.com/catalyst [at] lists/>
>>> Dev site: http://dev.catalyst.perl.org/
>>>
>>
>>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>
>


lists at eightdegrees

Dec 4, 2011, 3:49 AM

Post #7 of 7 (510 views)
Permalink
Re: Re: Catalyst::Test & Test::DBIx::Class [In reply to]

On Sun, Dec 4, 2011 at 7:59 PM, Dimitar Petrov <mitakaa [at] gmail> wrote:

> You might want to check this blog post also:
> http://www.modernperlbooks.com/mt/2011/11/parallelism-and-test-suites.html


thanks, but that's what got me into this mess.. well
http://www.modernperlbooks.com/mt/2011/12/controlling-test-parallelism-with-prove.html
which
also links to that..

ok, actually I've tidied up the mess and I'm rather pleased with how it
looks.. I'm going to have a lot more tests than this by the time I'm
finished so I think it's been well worth the effort.. (note the wallclock
secs)

$ prove Lecstor/t BB/t BB-Site-Catalyst/t aid_proxy/AID-Proxy/t
...
All tests successful.
Files=29, Tests=369, 109 wallclock secs ( 0.15 usr 0.04 sys + 26.25 cusr
4.36 csys = 30.80 CPU)


$ prove -j9 Lecstor/t BB/t BB-Site-Catalyst/t aid_proxy/AID-Proxy/t
...
All tests successful.
Files=29, Tests=369, 19 wallclock secs ( 0.18 usr 0.04 sys + 34.14 cusr
4.98 csys = 39.34 CPU)


cheers,

J



> Cheers
>
> On Sun, Dec 4, 2011 at 10:49 AM, Jason Galea <lists [at] eightdegrees>wrote:
>
>> On Sun, Dec 4, 2011 at 7:10 PM, Tomas Doran <bobtfish [at] bobtfish>wrote:
>>>
>>>>
>>>> On 4 Dec 2011, at 04:13, Jason Galea wrote:
>>>>
>>>> hmm.. actually.. can I hand Catalyst::Test the schema I can get from
>>>>> Test::DBIx::Class?
>>>>>
>>>>
>>>> I think you can just force replace the schema, with something like
>>>> MyApp->model('DB')->schema($**mytestschema);
>>>>
>>>
>> yup, works a treat.. thanks again.
>>
>> $ prove t
>> ...
>> All tests successful.
>> Files=6, Tests=90, 27 wallclock secs ( 0.07 usr 0.02 sys + 9.87 cusr
>> 1.14 csys = 11.10 CPU)
>>
>> Result: PASS
>>
>> $ prove -j9 t
>> ...
>> All tests successful.
>> Files=6, Tests=90, 8 wallclock secs ( 0.06 usr 0.01 sys + 11.24 cusr
>> 1.34 csys = 12.65 CPU)
>>
>> Result: PASS
>>
>> woohoo!
>>
>>
>>
>>
>>>
>>>> Alternatively, you can setup a test config (by writing out a config
>>>> file with the extra DB details in) before using Catalyst::Test (although
>>>> N.B. that use Catalyst::Test will happen at compile time, so you probably
>>>> need the initial setup in a BEGIN block).
>>>>
>>>> Cheers
>>>> t0m
>>>>
>>>>
>>>> ______________________________**_________________
>>>> List: Catalyst [at] lists
>>>> Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalyst<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>
>>>> Searchable archive: http://www.mail-archive.com/**
>>>> catalyst [at] lists/<http://www.mail-archive.com/catalyst [at] lists/>
>>>> Dev site: http://dev.catalyst.perl.org/
>>>>
>>>
>>>
>>
>> _______________________________________________
>> List: Catalyst [at] lists
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst [at] lists/
>> Dev site: http://dev.catalyst.perl.org/
>>
>>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>
>

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.