-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
test: Fail CDP commands on unhandled exceptions #9639
Conversation
Note: I did not include the playground test from #9539 yet, as this needs some more thought on how to turn this into a successful test. Let's first see which other tests cause an unhandled exception - it seems at least the serial console test should fail in a more useful way here. |
test/common/cdp-driver.js
Outdated
@@ -72,6 +73,8 @@ function setupLogging(client) { | |||
resolveLogPromise(); | |||
}); | |||
|
|||
client.Runtime.exceptionThrown(info => unhandledExceptions.push(info.exceptionDetails)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also be written to the console. Is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could (and indeed I had a local test version that did that). It would replicate the same message as the testlib.Error
, though, so it wouldn't tell anything new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are multiple exceptions, I really want to see them all, not just the last one. Similar to what we do with unexpected journal messages.
test/common/cdp-driver.js
Outdated
@@ -295,7 +298,7 @@ CDP.New(options) | |||
if (unhandledExceptions.length === 0) { | |||
success(reply); | |||
} else { | |||
fail(unhandledExceptions[0].exception.description); | |||
fail(unhandledExceptions[0].exception.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you figure it is the line breaks that break the protocol? Maybe we should still escape them here, in case the message also has multiple lines?
Still fails; I have an alternative approach locally, but I didn't work it out fully yet (higher priority things to do, sorry). |
The driver is sending an empty JSON Object |
Did a fixup which should fix the missing cases. Lets let this validate and then squash before merging. |
test/common/cdp-driver.js
Outdated
@@ -288,7 +299,19 @@ CDP.New(options) | |||
pageLoadPromise = new Promise((resolve, reject) => { pageLoadResolve = resolve; pageLoadReject = reject; }); | |||
|
|||
// run the command | |||
eval(command).then(success, fail); | |||
eval(command).then(reply => { | |||
var details, message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be let
test/common/cdp-driver.js
Outdated
@@ -72,6 +77,12 @@ function setupLogging(client) { | |||
resolveLogPromise(); | |||
}); | |||
|
|||
client.Runtime.exceptionThrown(info => { | |||
var details = info.exceptionDetails; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be let
Fixed for review. |
This works in general, thanks! I made a few TODOs at the top for particular crashes that this now picks up. |
Unlike the serial console one, the So I wonder if that is actually from our injected test code:
I'll add some debugging to |
I fixed the two issues above. Next move: bots. |
There are three (really four, but the check-metrics test failures have the same root cause) remaining test failures. I have a local fix for check-machines, the other two still need investigation. |
I now did a more general change to avoid the three new test failures, by filtering out unhandled exceptions from our own test suite. My TestMachines change from yesterday is still a nice cleanup, but I'll send it as a separate PR. |
Install a Chrome Devtools Protocol handler for unhandled exceptions, and fail the next CDP command with it. This got lost with the move from PhantomJS to Chrome. Some of our tests rely on failed ph_* function invocations, so we must not log failures of ph_wait_cond(); these are also technically unhandled exceptions. So turn this into a proper `PhWaitCondTimeout` error class, so that it can be identified reliably. Handle cases where undefined value is passed to fail/success in cdp-driver.js. Adjust the naughty override for the XTerm.js crash (cockpit-project#9641) as this now shows the actual underlying crash instead of just the followup element wait timeout. Closes cockpit-project#9639
The crash in |
|
There are several other reports about similar errors in c3. This seems to be some race condition when switching pages, which I suppose also means "(un)render in React". If I disable the I also logged the
I even tried to pin down |
still fails, this needs to be generalized - it does not only fail in
|
This gets triggered by the CPUUsage DonutChart in pkg/kubernetes/scripts/virtual-machines/components/VmMetricsTab.jsx. This seems to be some race condition when switching pages, which supposedly also means "(un)render in React". Cockpit code has no control over this, and it also does not break the user experience, so ignore the exception. See c3js/c3#2187 and simlilar issues bcbcarl/react-c3js#22 or c3js/c3#1205.
Yay! The remaining two failures on fedora-28 are well-known flakes, so retrying. This is ready for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
Install a Chrome Devtools Protocol handler for unhandled exceptions, and fail the next CDP command with it. This got lost with the move from PhantomJS to Chrome. Some of our tests rely on failed ph_* function invocations, so we must not log failures of ph_wait_cond(); these are also technically unhandled exceptions. So turn this into a proper `PhWaitCondTimeout` error class, so that it can be identified reliably. Handle cases where undefined value is passed to fail/success in cdp-driver.js. Adjust the naughty override for the XTerm.js crash (#9641) as this now shows the actual underlying crash instead of just the followup element wait timeout. Closes #9639
Install a Chrome Devtools Protocol handler for unhandled exceptions, and fail the next CDP command with it. This got lost with the move from PhantomJS to Chrome. Some of our tests rely on failed ph_* function invocations, so we must not log failures of ph_wait_cond(); these are also technically unhandled exceptions. So turn this into a proper `PhWaitCondTimeout` error class, so that it can be identified reliably. Handle cases where undefined value is passed to fail/success in cdp-driver.js. Adjust the naughty override for the XTerm.js crash (cockpit-project#9641) as this now shows the actual underlying crash instead of just the followup element wait timeout. Closes cockpit-project#9639 Cherry-picked from upstream master commit 9d3c17b, so that the naughty overrides match correctly.
Install a Chrome Devtools Protocol handler for unhandled exceptions, and fail the next CDP command with it. This got lost with the move from PhantomJS to Chrome. Some of our tests rely on failed ph_* function invocations, so we must not log failures of ph_wait_cond(); these are also technically unhandled exceptions. So turn this into a proper `PhWaitCondTimeout` error class, so that it can be identified reliably. Handle cases where undefined value is passed to fail/success in cdp-driver.js. Adjust the naughty override for the XTerm.js crash (#9641) as this now shows the actual underlying crash instead of just the followup element wait timeout. Closes #9639 Cherry-picked from upstream master commit 9d3c17b, so that the naughty overrides match correctly.
Install a Chrome Devtools Protocol handler for unhandled exceptions, and
fail the next CDP command with it.
This got lost with the move from PhantomJS to Chrome.
testSerialConsole
ph_*
rejectionsCannot read property 'data_types' of null
crash intest/verify/check-openshift TestOpenshift.testKubevirtMachinesList