Attempting to Expire a Silence results in "Unexpected end of JSON input" after clicking on the [Expire Silence] button in the Expire Silence modal.
Created attachment 1713003 [details] "Unexpected end of JSON input"
See CI Search: https://search.ci.openshift.org/?search=Monitoring%3A+Alerts+%22after+all%22+hook+for+%22creates+and+expires+a+Silence%22&maxAge=48h&context=3&type=junit&name=e2e-gcp-console&maxMatches=5&maxBytes=20971520&groupBy=job
Note with Cypress retries enabled, each 'expire silence failure' actually fails 3 times: https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/openshift_console/6340/pull-ci-openshift-console-master-e2e-gcp-console/1299344776004374528/artifacts/e2e-gcp-console/gui_test_screenshots/cypress/screenshots/monitoring/monitoring.spec.ts/
Traced down this flake. When 'Expiring A Silence' in normal console, `response.headers.get('Content-Length')' = '0' is true and co-fetch code returns "promise that resolves with an empty object" https://github.com/openshift/console/blob/cf7744e55f10bd7f05eafd57d8485254862faba8/frontend/public/co-fetch.js#L157 When 'Expiring A Silence' from Cypress, `response.headers.get('Content-Length')` = null! So co-fetch code continues on and eventually tries to return `response.json()`, which fails due to no json ("Unexpected end of JSON input"): https://github.com/openshift/console/blob/cf7744e55f10bd7f05eafd57d8485254862faba8/frontend/public/co-fetch.js#L163 Wonder if this: // If the response has no body, return promise that resolves with an empty object if (response.headers.get('Content-Length') === '0') { return Promise... Should be changed to this: // If the response has no body, return promise that resolves with an empty object if (response.headers.get('Content-Length') === '0' ----> || response.headers.get('Content-Length') === null <-----) { return Promise Would like to understand why Cypress is returning null for `response.headers.get('Content-Length')` though.
Hi XiaochuanWang, the ''Content-Length'=null` was an error in the console code which was fixed via the associated github PR, so the issue has been fixed. If you can expire a silence, then all is good.
Hi David, I checked the different ways of expire a silence, no empty length response header from the requests. Then the bug could be Verified. Thanks for your info. Verified on 4.6.0-0.nightly-2020-09-07-191134
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:4196