Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also show "investigation" tabs for incomplete jobs #3981

Merged
merged 2 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
kalikiana marked this conversation as resolved.
Show resolved Hide resolved
},
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 @@ -1957,7 +1957,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) {
okurz marked this conversation as resolved.
Show resolved Hide resolved
$inv{first_bad} = {type => 'link', link => '/tests/' . $prev->id, text => $prev->id};
next;
}
Expand Down Expand Up @@ -2223,7 +2223,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