#!perl
use Cassandane::Tiny;

sub test_fatals_abort_disabled
    :NoStartInstances
    ($self)
{
    $self->{instance}->{config}->set(
        'fatals_abort' => 'no',
        'prometheus_enabled' => 'no',
    );
    $self->_start_instances();

    my $basedir = $self->{instance}->get_basedir();

    # run `promstatsd -1` without having set up for prometheus, which should
    # produce a "Prometheus metrics are not being tracked..." fatal error
    eval {
        $self->{instance}->run_command({ cyrus => 1 }, 'promstatsd', '-1');
    };
    my $e = $@;
    $self->assert_not_null($e);
    $self->assert_matches(qr{promstatsd pid \d+\) exited with code 78},
                          $e->{'-text'});

    # post-test sanity checks will complain for us if a core was left behind
}
