7 use lib "$FindBin::Bin/lib";
9 use Storable qw/lock_store lock_retrieve/;
12 use Catalyst::Test 'TestApp';
14 our $STATE = "$FindBin::Bin/lib/TestApp/scheduler.state";
18 event => '/cron/every_minute',
22 # hack the last event check to make all events execute immediately
23 my $state = { last_check => 0 };
24 lock_store $state, $STATE;
27 TestApp->config->{scheduler}->{hosts_allow} = '1.2.3.4';
29 # test that the event does not execute
31 ok( my $res = request('http://localhost/'), 'request ok' );
32 is( $res->content, 'default', 'response ok' );
33 is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", undef, 'every_minute did not execute, ok' );
34 unlink "$FindBin::Bin/lib/TestApp/every_minute.log";
37 # hack the last event check to make all events execute immediately
38 $state = lock_retrieve $STATE;
39 $state->{last_check} = 0;
40 lock_store $state, $STATE;
43 TestApp->config->{scheduler}->{hosts_allow} = [ '1.2.3.4', '127.0.0.1' ];
45 # test that the event does execute
47 ok( my $res = request('http://localhost/'), 'request ok' );
48 is( $res->content, 'default', 'response ok' );
49 is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", 1, 'every_minute executed ok' );
50 unlink "$FindBin::Bin/lib/TestApp/every_minute.log";