Skip to content

Commit

Permalink
WIP test
Browse files Browse the repository at this point in the history
  • Loading branch information
elliefm committed Jun 26, 2024
1 parent 193279e commit 2b4ae28
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions cassandane/Cassandane/Cyrus/Simple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -303,22 +303,36 @@ EOF
}

sub test_fatals_abort
:NoStartInstances
{
my ($self) = @_;

$self->{instance}->{config}->set(
'fatals_abort' => 'yes',
'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({
redirects => { stdout => "$basedir/promstatsd.out",
stderr => "$basedir/promstatsd.err",
},
cyrus => 1,
}, 'promstatsd', '-1');
$self->{instance}->run_command({ cyrus => 1 }, 'promstatsd', '-1');
};
my $e = $@;
xlog "XXX promstatsd: " . Dumper $e;
assert_non_null($e); # better not have succeeded by mistake...
$self->assert_not_null($e);
$self->assert_matches(qr{promstatsd pid \d+\) terminated by signal 6},
$e->{'-text'});

my @cores = $self->{instance}->find_cores();
if (@cores) {
# if we dumped core, there'd better only be one core file
$self->assert_num_equals(1, scalar @cores);

# don't barf on it existing during shutdown
unlink $cores[0];
}
}

1;

0 comments on commit 2b4ae28

Please sign in to comment.