Skip to content

Commit

Permalink
Web UI gating summary: account for 'running' tests
Browse files Browse the repository at this point in the history
We can distinguish between results that are completely missing,
and cases where we know the test is queued or running (here, we
just flatten that to 'running' for simplicity). Take advantage
of this to generate a more useful and detailed gating status
summary, when the information is available.

This should also prevent us duplicating running test results in
the result table, which right now I believe we would do in any
case where queued/running test info is available. With this
change, we only create an ABSENT row for results that are truly
missing.

Signed-off-by: Adam Williamson <[email protected]>
(cherry picked from commit 6eea927)
  • Loading branch information
AdamWill authored and mergify[bot] committed Mar 18, 2023
1 parent 556fdbf commit 62e9f43
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
47 changes: 30 additions & 17 deletions bodhi-server/bodhi/server/templates/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -785,17 +785,23 @@ <h3 class="modal-title" id="waiveModalLabel">Trigger Tests</h3>
var reqs_counter = 0;
var unsatisfied_reqs_counter = 0;
var missing_reqs_counter = 0;
var running_reqs_counter = 0;
var greenwave_errors = 0;

// handle Greenwave decision
var handle_unsatisfied_requirements = function(data){
$.each(data['unsatisfied_requirements'], function(i, requirement) {
unsatisfied_reqs_counter++;
if (requirement.type == 'test-result-missing') {
missing_reqs_counter++;
if (missing_tests[requirement.subject_identifier] === undefined)
missing_tests[requirement.subject_identifier] = [];
missing_tests[requirement.subject_identifier].push(requirement);
if (requirement.result_id) {
running_reqs_counter++;
}
else {
missing_reqs_counter++;
if (missing_tests[requirement.subject_identifier] === undefined)
missing_tests[requirement.subject_identifier] = [];
missing_tests[requirement.subject_identifier].push(requirement);
}
}
// the user may have already specified this in the required taskotron tests
if ($.inArray(requirement.testcase, requirements) == -1) {
Expand All @@ -812,28 +818,35 @@ <h3 class="modal-title" id="waiveModalLabel">Trigger Tests</h3>
if (missing_reqs_counter > 0) {
label_class = classes['ABSENT'];
icon_class = icons['ABSENT'];
} else if (running_reqs_counter > 0) {
label_class = classes['RUNNING'];
icon_class = icons['RUNNING'];
} else if (unsatisfied_reqs_counter > 0) {
label_class = classes['FAILED'];
icon_class = icons['FAILED'];
} else {
label_class = classes['PASSED'];
icon_class = icons['PASSED'];
}
var summary = '';
failed_reqs_counter = unsatisfied_reqs_counter - missing_reqs_counter;
var summary = [];
failed_reqs_counter = unsatisfied_reqs_counter - missing_reqs_counter - running_reqs_counter;
if (reqs_counter == 0) {
summary = 'no tests are required';
} else if (failed_reqs_counter > 0 && missing_reqs_counter > 0) {
summary = failed_reqs_counter + ' of ' + reqs_counter + ' required tests failed, ' + missing_reqs_counter + ' results missing';
} else if (missing_reqs_counter > 0) {
summary = missing_reqs_counter + ' of ' + reqs_counter + ' required test results missing';
}
else if (failed_reqs_counter > 0) {
summary = failed_reqs_counter + ' of ' + reqs_counter + ' required tests failed';
}
else {
summary = 'All required tests passed';
summary = ['no tests are required'];
} else {
if (failed_reqs_counter > 0) {
summary.push(failed_reqs_counter + ' of ' + reqs_counter + ' required tests failed');
}
if (running_reqs_counter > 0) {
summary.push(running_reqs_counter + ' of ' + reqs_counter + ' required tests running');
}
if (missing_reqs_counter > 0) {
summary.push(missing_reqs_counter + ' of ' + reqs_counter + ' required test results missing');
}
if (summary.length == 0) {
summary = ['All required tests passed'];
}
}
summary = summary.join(', ')

var html = '<span class="badge text-bg-' + label_class + '">' +
'<span class="fa fa-' + icon_class + '">' +
Expand Down
1 change: 1 addition & 0 deletions news/PR5139.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The automated tests tab will now display information about `queued` and `running` tests

0 comments on commit 62e9f43

Please sign in to comment.