Clarify travis timings
[dbsrgits/DBIx-Class.git] / t / storage / ping_count.t
CommitLineData
25546937 1use strict;
f54428ab 2use warnings;
25546937 3
25546937 4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
25546937 7use DBIC::SqlMakerTest;
8
9my $ping_count = 0;
10
11{
12 local $SIG{__WARN__} = sub {};
13 require DBIx::Class::Storage::DBI;
14
15 my $ping = \&DBIx::Class::Storage::DBI::_ping;
16
17 *DBIx::Class::Storage::DBI::_ping = sub {
18 $ping_count++;
19 goto &$ping;
20 };
21}
22
d68d84f8 23
9ae966b9 24# measure pings around deploy() separately
d68d84f8 25my $schema = DBICTest->init_schema( sqlite_use_file => 1, no_populate => 1 );
26
9ae966b9 27is ($ping_count, 0, 'no _ping() calls during deploy');
28$ping_count = 0;
29
30
d68d84f8 31
32DBICTest->populate_schema ($schema);
33
28be49a6 34# perform some operations and make sure they don't ping
25546937 35
28be49a6 36$schema->resultset('CD')->create({
37 cdid => 6, artist => 3, title => 'mtfnpy', year => 2009
38});
25546937 39
28be49a6 40$schema->resultset('CD')->create({
41 cdid => 7, artist => 3, title => 'mtfnpy2', year => 2009
42});
25546937 43
28be49a6 44$schema->storage->_dbh->disconnect;
25546937 45
28be49a6 46$schema->resultset('CD')->create({
47 cdid => 8, artist => 3, title => 'mtfnpy3', year => 2009
48});
25546937 49
28be49a6 50$schema->storage->_dbh->disconnect;
25546937 51
28be49a6 52$schema->txn_do(sub {
53 $schema->resultset('CD')->create({
54 cdid => 9, artist => 3, title => 'mtfnpy4', year => 2009
55 });
56});
25546937 57
58is $ping_count, 0, 'no _ping() calls';
d68d84f8 59
60done_testing;