-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
test to reproduce behavior of issue brianc/node-postgres#549 #572
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
Conversation
It's okay with the duplicated code, I don't mind. 😄 Duplicated is better than none! So...this tests passes in its current form, but it's supposed to fail to demonstrate a bug that's fixed in #549 ? Not sure exactly how or why it's passing before the fix has been merged. I'm probably missing what's actually going on here...if you want to submit a failing test to indicate the behavior and then have me run it with the #549 pull request to verify it's fixed I'm cool with it. |
hmm, you're right, I was actually testing a different path. The handleError I wanted to test happens on connection end(), while the previous version of the test covered error connection event. With the last commit, I've put them both side by side in the test and make sure it fails before and not after:
Is it correct that in neither case the query emits an error event? |
The test would fail when running as native when checking the error string. I think it's better if both are consistent so I've changed it to be the same. |
OK, I need some guidance as the native version differs greatly from the Javascript one. The test just hangs there never calling back. Is it intended that the behavior should be reimplemented in the native version? There's no Connection.sync() to start with, so I'm not sure what work is needed. |
Continuous build tripped on an intermittent failure here:
I can reproduce by repeatedly calling the test:
Updated to make it work as per:
I found it questionable that we would set the state _ending after calling _send so I moved it before calling _send. |
Where does the test hang on the native version? |
The sleep query never calls the callback. I've confirmed the killIdleQuery goes through ok. |
a fix was provided in 5079c1e; test is modeled on query-error-handling-tests.js; test both kill query and disconnection on prepared statement execution; make connection error string message consistent between native and non-native; disable test server-side kill for native as it hangs; sync can cause error to be emitted so we catch that; we also move _ending state before _send is called.
Thank you so much for your help and work on this. Means a lot to me! I'm like hair on 🔥 at work right now so it took me longer than I should have to get to this...but it's much appreciated. 👍 |
test to reproduce behavior of issue #549
Trying to fix: TypeError: Cannot call method 'sync' of undefined at Query.handleError (/voxer/deploy/server/node_modules/zag-backend-pg/node_modules/pg/lib/query.js:92:16) at Client.connect (/voxer/deploy/server/node_modules/zag-backend-pg/node_modules/pg/lib/client.js:184:24) at g (events.js:192:14) at EventEmitter.emit (events.js:93:17) at Socket.<anonymous> (/voxer/deploy/server/node_modules/zag-backend-pg/node_modules/pg/lib/connection.js:60:10) at Socket.EventEmitter.emit (events.js:93:17) at TCP.onread (net.js:423:51) via brianc/node-postgres#572.
for #549
With some console.log, the output looks like:
copy of query-error-handling-tests.js
a fix was provided in 5079c1e
I would suggest that I provide additional CLs to refactor killIdleQuery in test-helper to reduce duplicated code.