Skip to content

Commit

Permalink
Merge pull request os-autoinst#3981 from okurz/feature/investigate_in…
Browse files Browse the repository at this point in the history
…completes

Also show "investigation" tabs for incomplete jobs
  • Loading branch information
okurz authored Jan 25, 2022
2 parents 46c388a + f07d4f4 commit 0966958
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets/javascripts/test_result.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const tabConfiguration = {
investigation: {
descriptiveName: 'investigation info',
conditionForShowingNavItem: function () {
return testStatus.state === 'done' && testStatus.result === 'failed';
return testStatus.state === 'done' && (testStatus.result === 'failed' || testStatus.result === 'incomplete');
},
renderContents: renderInvestigationTab
},
Expand Down
3 changes: 3 additions & 0 deletions lib/OpenQA/Jobs/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,6 @@ my %META_RESULT_MAPPING = (
);
sub meta_state ($state) { $META_STATE_MAPPING{$state} // NONE }
sub meta_result ($result) { $META_RESULT_MAPPING{$result} // NONE }
sub is_ok_result ($result) {
!!grep { $result eq $_ } OK_RESULTS;
}
5 changes: 3 additions & 2 deletions lib/OpenQA/Schema/Result/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1953,7 +1953,7 @@ sub investigate {
return {error => 'No result directory available for current job'} unless $self->result_dir();
my $ignore = OpenQA::App->singleton->config->{global}->{job_investigate_ignore};
for my $prev (@previous) {
if ($prev->result eq 'failed') {
if ($prev->should_show_investigation) {
$inv{first_bad} = {type => 'link', link => '/tests/' . $prev->id, text => $prev->id};
next;
}
Expand Down Expand Up @@ -2228,7 +2228,8 @@ sub should_show_autoinst_log {
sub should_show_investigation {
my ($self) = @_;

return $self->state ne DONE || $self->result eq FAILED;
OpenQA::Jobs::Constants::meta_state($self->state) ne OpenQA::Jobs::Constants::FINAL
|| !OpenQA::Jobs::Constants::is_ok_result($self->result);
}

sub status {
Expand Down
3 changes: 3 additions & 0 deletions t/ui/18-tests-details.t
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ subtest 'reason and log details on incomplete jobs' => sub {
my $log_element = $driver->find_element_by_xpath('//*[@id="details"]//pre[string-length(text()) > 0]');
like($log_element->get_attribute('data-src'), qr/autoinst-log.txt/, 'log file embedded');
like($log_element->get_text(), qr/Crashed\?/, 'log contents loaded');
$driver->find_element_by_link_text('Investigation')->click;
$driver->find_element('table#investigation_status_entry')
->text_like(qr/cannot provide hints/, 'investigation status content shown as table');
};

sub update_status {
Expand Down

0 comments on commit 0966958

Please sign in to comment.