Skip to content

Commit d91aff8

Browse files
cfconradilmanzo
authored andcommitted
wicked: Check only logs created during test
We should not check older logs. Otherwise we would get a log error in all subsequence tests showing the same issue, but they actually occured only in the first run/boot.
1 parent 7500702 commit d91aff8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/wickedbase.pm

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -858,17 +858,22 @@ sub skip_check_logs_on_post_run {
858858
shift->{skip_check_logs_on_post_run} = 1;
859859
}
860860

861+
sub get_log_cursor {
862+
my $cursor = script_output(q(journalctl -o export -n 1 | tr -dc '\n|[[:print:]]' | grep __CURSOR));
863+
($cursor) = ($cursor =~ /^__CURSOR=(.*)$/m);
864+
return $cursor;
865+
}
866+
861867
sub check_logs {
862868
my $self = shift;
863869
my $code = shift;
864-
my $cursor = '';
870+
my $cursor = $self->{pre_run_log_cursor} // '';
865871

866872
if (ref($code) eq 'CODE') {
867-
$cursor = script_output(q(journalctl -o export -n 1 | tr -dc '\n|[[:print:]]' | grep __CURSOR));
868-
($cursor) = ($cursor =~ /^__CURSOR=(.*)$/m);
869-
$cursor = "-c '$cursor'";
873+
$cursor = $self->get_log_cursor();
870874
$code->();
871875
}
876+
$cursor = "-c '$cursor'" if (length($cursor) > 0);
872877
my @units = qw(wickedd-nanny wickedd-dhcp4 wickedd-dhcp6 wicked wickedd);
873878
my $default_exclude = 'wickedd=process \d+ has not exited yet; now doing a blocking waitpid';
874879
$default_exclude .= ',wickedd-dhcp6=Link-local IPv6 address is marked duplicate:';
@@ -995,6 +1000,7 @@ sub pre_run_hook {
9951000
set_var('WICKED_TCPDUMP_PID', script_output('echo $CHECK_TCPDUMP_PID'));
9961001
}
9971002
$self->upload_wicked_logs('pre');
1003+
$self->{pre_run_log_cursor} = $self->get_log_cursor() if ($self->{name} ne 'before_test');
9981004
$self->SUPER::pre_run_hook;
9991005
$self->do_barrier('pre_run');
10001006
}

0 commit comments

Comments
 (0)