diff --git a/bodhi-server/bodhi/server/templates/update.html b/bodhi-server/bodhi/server/templates/update.html
index 870a01f588..f5eb751a24 100644
--- a/bodhi-server/bodhi/server/templates/update.html
+++ b/bodhi-server/bodhi/server/templates/update.html
@@ -398,6 +398,7 @@
% if can_edit and update.test_gating_status == models.TestGatingStatus.failed and update.status == models.UpdateStatus.testing:
@@ -625,6 +626,7 @@
How to install
@@ -757,11 +759,17 @@
Trigger Tests
// show the Greenwave decision
var greenwave_api_url = '${request.registry.settings["greenwave_api_url"]}';
var missing_tests = {};
+ var reqs_counter = 0;
+ var unsatisfied_reqs_counter = 0;
+ var missing_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);
@@ -775,45 +783,69 @@
Trigger Tests
// there is at least one unsatisfied requirement, so show the button to be able to waive.
$('#waive').removeAttr('hidden');
});
- % if request.registry.settings.get("test_gating.required") is True:
- if (data['policies_satisfied']) {
- label_class = classes['PASSED'];
- icon_class = icons['PASSED'];
- } else if (missing_tests.length != 0) {
- label_class = classes['ABSENT'];
- icon_class = icons['ABSENT'];
- } else {
- label_class = classes['FAILED'];
- icon_class = icons['FAILED'];
- }
+ };
- var html = '
' +
- '' +
- ' ';
- html += '
' + data['summary'];
- html += '';
- if (data.waivers.length != 0) {
- // Create url to waiverdb with waivers for this update
- var url = '${request.registry.settings["waiverdb_api_url"]}';
- url += '/waivers'
- url += '/?product_version=' + data.waivers[0].product_version;
- url += '&subject_type=' + data.waivers[0].subject_type;
- url += '&subject_identifier=' + data.waivers[0].subject_identifier;
- html += '
';
- html += '' +
- '';
- html += '';
- }
- $('#test_status_badge').append(html);
- $('#resultsdb h3').after(html);
+ var generate_requirements_summary = function() {
+ if (missing_reqs_counter > 0) {
+ label_class = classes['ABSENT'];
+ icon_class = icons['ABSENT'];
+ } 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;
+ 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';
+ }
- $('.gating-summary').click(function(e){
- e.preventDefault();
- $('.nav-tabs a[href="#automatedtests"]').tab('show');
+ var html = '
' +
+ '' +
+ ' ';
+ html += '
' + summary;
+ html += '';
+ if (Object.keys(waivers).length != 0) {
+ var seensubjects = [];
+ // Create urls to waiverdb with waivers for this update
+ $.each(Object.keys(waivers), function(i, testcase) {
+ $.each(waivers[testcase], function(j, waiver) {
+ if (!seensubjects.includes(waiver.subject_identifier)) {
+ seensubjects.push(waiver.subject_identifier);
+ var url = '${request.registry.settings["waiverdb_api_url"]}';
+ url += '/waivers'
+ url += '/?product_version=' + waiver.product_version;
+ url += '&subject_type=' + waiver.subject_type;
+ url += '&subject_identifier=' + waiver.subject_identifier;
+ html += '
';
+ html += '' +
+ '';
+ html += '';
+ }
+ });
});
- % endif
+ }
+ $('#test_status_badge .gating-summary').replaceWith(html);
+ $('#resultsdb .gating-summary').replaceWith(html);
+
+ $('.gating-summary').click(function(e){
+ e.preventDefault();
+ $('.nav-tabs a[href="#automatedtests"]').tab('show');
+ });
};
var get_greenwave_information = function(request, after_success) {
@@ -829,6 +861,8 @@
Trigger Tests
waivers[waiver.testcase].push(waiver);
});
handle_unsatisfied_requirements(data);
+ reqs_counter += data['unsatisfied_requirements'].length;
+ reqs_counter += data['satisfied_requirements'].length;
// we don't want to generate result rows for both the
// critpath and non-critpath decision contexts, as both
// queries return the same set of test results
@@ -838,11 +872,8 @@
Trigger Tests
after_success();
},
error: function (jqxhr, status, error) {
+ greenwave_errors = 1;
finish();
- $('#resultsdb h3').after(
- '
Failed to talk to Greenwave.
');
- $('#test_status_badge').append(
- '
Failed to talk to Greenwave.');
},
});
};
@@ -1039,6 +1070,9 @@
Trigger Tests
update()
if (current_batch >= request_batches.length) {
+ % if request.registry.settings.get("test_gating.required") is True:
+ if (!greenwave_errors) { generate_requirements_summary(); }
+ % endif
progress.remove()
finish();
return;
diff --git a/news/4320.bug b/news/4320.bug
new file mode 100644
index 0000000000..a60e7fec0d
--- /dev/null
+++ b/news/4320.bug
@@ -0,0 +1 @@
+The update page now shows a single combined gating status, instead of listing the result of each separate greenwave query