Bug 1873612 - Monitoring: Alerts "after all" hook for "creates and expires a Silence"
Summary: Monitoring: Alerts "after all" hook for "creates and expires a Silence"
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.6
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.6.0
Assignee: David Taylor
QA Contact: XiaochuanWang
Depends On:
TreeView+ depends on / blocked
Reported: 2020-08-28 18:25 UTC by David Taylor
Modified: 2020-09-09 01:57 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:
Target Upstream Version:

Attachments (Terms of Use)
"Unexpected end of JSON input" (536.34 KB, image/png)
2020-08-28 18:26 UTC, David Taylor
no flags Details

System ID Priority Status Summary Last Updated
Github openshift console pull 6490 None closed Bug 1873612: Handle empty responses if Content-Length is not specified 2020-09-07 01:06:58 UTC

Description David Taylor 2020-08-28 18:25:13 UTC
Attempting to Expire a Silence results in "Unexpected end of JSON input" after clicking on the [Expire Silence] button in the Expire Silence modal.

Comment 1 David Taylor 2020-08-28 18:26:30 UTC
Created attachment 1713003 [details]
"Unexpected end of JSON input"

Comment 4 David Taylor 2020-09-01 19:38:56 UTC
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"


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"):


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.

Comment 8 David Taylor 2020-09-08 13:32:31 UTC
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.

Comment 9 XiaochuanWang 2020-09-09 01:57:55 UTC
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

Note You need to log in before you can comment on or make changes to this bug.