#!perl
use Cassandane::Tiny;

sub test_at_event_bad ($self)
{
    my $srv = $self->lemming_service(tag => 'A');

    # schedule an event with a bad at=hhmm specification
    $self->lemming_event(tag => 'B',
                         mode => 'success',
                         at => '2401');
    eval {
        $self->start();
    };
    my $e = $@;
    # The exception thrown depends on how cassandane and master race
    # against one another.  If master wins, cassandane gets stuck waiting
    # for the PID file to be valid, and eventually throws a timeout
    # exception.  If cassandane wins, it correctly detects that master is
    # no longer running, and throws that.
    $self->assert_not_null($e);
#     $self->assert_matches(qr{the master PID file to exist}, $e);
#     $self->assert_matches(qr{Master no longer running}, $e);

    $self->assert_num_equals(0, $self->{instance}->is_running());
    $self->assert_syslog_matches($self->{instance},
                                 qr{invalid at=hhmm specification});
}
