Browse Source

Bug 17476: Add a way to bypass dt_from_string processing time for slow servers

We already change this value from 1 to 2 but apparently it's not enough
So let's switch it back to on and add a flag (env var SLOW_SERVER) and skip these tests
if set

Test plan:
  prove t/DateUtils.t
and
  SLOW_SERVER=1 prove t/DateUtils.t

should return green

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
16.11.x
Jonathan Druart 8 years ago
committed by Kyle M Hall
parent
commit
8eec57d605
  1. 23
      t/DateUtils.t

23
t/DateUtils.t

@ -75,16 +75,19 @@ isa_ok( $new_dt, 'DateTime', 'Create DateTime with different timezone' );
cmp_ok( $new_dt->ymd(), 'eq', $testdate_iso,
'Returned Dublin object matches input' );
for ( qw/ 2014-01-01 2100-01-01 9999-01-01 / ) {
my $duration = gettimeofday();
$new_dt = dt_from_string($_, 'iso', $dear_dirty_dublin);
$duration = gettimeofday() - $duration;
cmp_ok $duration, '<', 2, "Create DateTime with dt_from_string() for $_ with TZ in less than 2s";
$duration = gettimeofday();
output_pref( { dt => $new_dt } );
$duration = gettimeofday() - $duration;
cmp_ok $duration, '<', 2, "Create DateTime with output_pref() for $_ with TZ in less than 2s";
}
SKIP: {
skip "Don't test execution time of dt_from_string on slow servers", 6 if $ENV{SLOW_SERVER};
for ( qw/ 2014-01-01 2100-01-01 9999-01-01 / ) {
my $duration = gettimeofday();
$new_dt = dt_from_string($_, 'iso', $dear_dirty_dublin);
$duration = gettimeofday() - $duration;
cmp_ok $duration, '<', 1, "Create DateTime with dt_from_string() for $_ with TZ in less than 1s";
$duration = gettimeofday();
output_pref( { dt => $new_dt } );
$duration = gettimeofday() - $duration;
cmp_ok $duration, '<', 1, "Create DateTime with output_pref() for $_ with TZ in less than 1s";
}
};
$new_dt = dt_from_string( '2011-06-16 12:00', 'sql' );
isa_ok( $new_dt, 'DateTime', 'Create DateTime from (mysql) sql' );

Loading…
Cancel
Save