Bug 16044: Make tests from t/Cache.t pass
The timeout does not impact the L1 cache (it would be to time consuming and not really useful to do that for this cache). To simulate the real timeout, we need to flush this L1 cache when needed. It would be also done adding a disable_L1_cache method. Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
dda7a0a25f
commit
bbfe394bb6
1 changed files with 5 additions and 0 deletions
|
@ -43,6 +43,7 @@ SKIP: {
|
|||
# test expiry time in cache
|
||||
$cache->set_in_cache( "timeout", "I AM DATA", 1 ); # expiry time of 1 second
|
||||
sleep 2;
|
||||
$cache->flush_L1_cache();
|
||||
is( $cache->get_from_cache("timeout"),
|
||||
undef, "fetching expired item from cache" );
|
||||
|
||||
|
@ -88,7 +89,9 @@ SKIP: {
|
|||
);
|
||||
ok( defined($myscalar), 'Created tied scalar' );
|
||||
is( $$myscalar, 1, 'Constructor called to first initialize' );
|
||||
$cache->flush_L1_cache();
|
||||
is( $$myscalar, 1, 'Data retrieved from cache' );
|
||||
$cache->flush_L1_cache();
|
||||
sleep 2;
|
||||
is( $$myscalar, 2, 'Constructor called again when timeout reached' );
|
||||
$$myscalar = 5;
|
||||
|
@ -119,6 +122,7 @@ SKIP: {
|
|||
is($myhash->{'key2'}, 'surprise', 'Setting hash member worked');
|
||||
$hash{'key2'} = 'nosurprise';
|
||||
sleep 2;
|
||||
$cache->flush_L1_cache();
|
||||
is($myhash->{'key2'}, 'nosurprise', 'Cache change caught');
|
||||
|
||||
|
||||
|
@ -134,6 +138,7 @@ SKIP: {
|
|||
$hash{'anotherkey'} = 'anothervalue';
|
||||
|
||||
sleep 2;
|
||||
$cache->flush_L1_cache();
|
||||
|
||||
ok(exists $myhash->{'anotherkey'}, 'Cache reset properly');
|
||||
|
||||
|
|
Loading…
Reference in a new issue