Revert "Fix a bug with session counting for WEBGUI_TEST_DEBUG"
This reverts commit f53af08e27.
This commit is contained in:
parent
5fc2a1f248
commit
65a58eed62
1 changed files with 23 additions and 29 deletions
|
|
@ -74,8 +74,6 @@ our @EXPORT_OK = qw(session config);
|
||||||
my $CLASS = __PACKAGE__;
|
my $CLASS = __PACKAGE__;
|
||||||
|
|
||||||
my @guarded;
|
my @guarded;
|
||||||
our @checkCount;
|
|
||||||
our %initCounts;
|
|
||||||
|
|
||||||
sub import {
|
sub import {
|
||||||
our $CONFIG_FILE = $ENV{ WEBGUI_CONFIG };
|
our $CONFIG_FILE = $ENV{ WEBGUI_CONFIG };
|
||||||
|
|
@ -101,22 +99,30 @@ sub import {
|
||||||
|
|
||||||
if ($ENV{WEBGUI_TEST_DEBUG}) {
|
if ($ENV{WEBGUI_TEST_DEBUG}) {
|
||||||
##Offset Sessions, and Scratch by 1 because 1 will exist at the start
|
##Offset Sessions, and Scratch by 1 because 1 will exist at the start
|
||||||
@checkCount = (
|
my @checkCount = (
|
||||||
Sessions => userSession => 1,
|
Sessions => 'userSession',
|
||||||
Scratch => userSessionScratch => 1,
|
Scratch => 'userSessionScratch',
|
||||||
Users => users => 0,
|
Users => 'users',
|
||||||
Groups => groups => 0,
|
Groups => 'groups',
|
||||||
mailQ => mailQueue => 0,
|
mailQ => 'mailQueue',
|
||||||
Tags => assetVersionTag => 0,
|
Tags => 'assetVersionTag',
|
||||||
Assets => assetData => 0,
|
Assets => 'assetData',
|
||||||
Workflows => Workflow => 0,
|
Workflows => 'Workflow',
|
||||||
Carts => cart => 0,
|
|
||||||
);
|
);
|
||||||
for ( my $i = 0; $i < @checkCount; $i += 3) {
|
my %initCounts;
|
||||||
|
for ( my $i = 0; $i < @checkCount; $i += 2) {
|
||||||
my ($label, $table) = @checkCount[$i, $i+1];
|
my ($label, $table) = @checkCount[$i, $i+1];
|
||||||
$initCounts{$table} = $session->db->quickScalar('SELECT COUNT(*) FROM ' . $table);
|
$initCounts{$table} = $session->db->quickScalar('SELECT COUNT(*) FROM ' . $table);
|
||||||
}
|
}
|
||||||
push @guarded, Scope::Guard->new(sub {
|
push @guarded, Scope::Guard->new(sub {
|
||||||
|
for ( my $i = 0; $i < @checkCount; $i += 2) {
|
||||||
|
my ($label, $table) = @checkCount[$i, $i+1];
|
||||||
|
my $quant = $session->db->quickScalar('SELECT COUNT(*) FROM ' . $table);
|
||||||
|
my $delta = $quant - $initCounts{$table};
|
||||||
|
if ($delta) {
|
||||||
|
$CLASS->builder->diag(sprintf '%-10s: %4d (delta %+d)', $label, $quant, $delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,22 +139,10 @@ sub cleanup {
|
||||||
pop @guarded
|
pop @guarded
|
||||||
while @guarded;
|
while @guarded;
|
||||||
|
|
||||||
if ( my $session = $CLASS->session ) {
|
if ( $SESSION ) {
|
||||||
$session->var->end;
|
$SESSION->var->end;
|
||||||
my $db = delete $session->{_db};
|
$SESSION->close;
|
||||||
$session->close;
|
undef $SESSION;
|
||||||
##Do this absolutely last, so that there's no session or other object pieces left over.
|
|
||||||
if ($ENV{WEBGUI_TEST_DEBUG}) {
|
|
||||||
for ( my $i = 0; $i < @checkCount; $i += 3) {
|
|
||||||
my ($label, $table, $offset) = @checkCount[$i, $i+1, $i+2];
|
|
||||||
my $quant = $db->quickScalar('SELECT COUNT(*) FROM ' . $table);
|
|
||||||
my $delta = $quant - $initCounts{$table} + $offset;
|
|
||||||
if ($delta) {
|
|
||||||
$CLASS->builder->diag(sprintf '%-10s: %4d (delta %+d)', $label, $quant, $delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$db->disconnect;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue