#!perl use Cassandane::Tiny; sub test_override_double :min_version_3_0 { my ($self) = @_; my $CalDAV = $self->{caldav}; my $CalendarId = $CalDAV->NewCalendar({name => 'foo'}); $self->assert_not_null($CalendarId); my $now = DateTime->now(); $now->set_time_zone('Australia/Sydney'); # bump everything forward so a slow run (say: valgrind) # doesn't cause things to magically fire... $now->add(DateTime::Duration->new(seconds => 300)); # define an event that started almost an hour ago and repeats hourly my $startdt = $now->clone(); $startdt->subtract(DateTime::Duration->new(minutes => 59, seconds => 55)); my $start = $startdt->strftime('%Y%m%dT%H%M%S'); my $enddt = $startdt->clone(); $enddt->add(DateTime::Duration->new(seconds => 15)); my $end = $enddt->strftime('%Y%m%dT%H%M%S'); # the next event will start in a few seconds my $recuriddt = $now->clone(); $recuriddt->add(DateTime::Duration->new(seconds => 5)); my $recurid = $recuriddt->strftime('%Y%m%dT%H%M%S'); my $rstartdt = $recuriddt->clone(); my $recurstart = $recuriddt->strftime('%Y%m%dT%H%M%S'); my $renddt = $rstartdt->clone(); $renddt->add(DateTime::Duration->new(seconds => 15)); my $recurend = $renddt->strftime('%Y%m%dT%H%M%S'); my $lastrepl = $recuriddt->clone(); $lastrepl->add(DateTime::Duration->new(minutes => 60)); my $lastalarm = $lastrepl->strftime('%Y%m%dT%H%M%S'); # set the trigger to notify us at the start of the event my $trigger="PT0S"; my $uuid = "574E2CD0-2D2A-4554-8B63-C7504481D3A9"; my $href = "$CalendarId/$uuid.ics"; my $card = <Request('PUT', $href, $card, 'Content-Type' => 'text/calendar'); # clean notification cache $self->{instance}->getnotify(); # trigger processing of alarms $self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() + 6000 ); $self->assert_alarms({summary => 'exception', start => $recurstart}, {summary => 'main', start => $lastalarm}); }