getServerInfo() not being awaited properly
ToucanBran opened this issue · comments
Bug Report
Our CI pipeline reports inconsistent failed tests stating that jest is timing out.
I can't duplicate it locally for some reason but here's a test I wrote
describe('getServerInfo() Test', () => {
test(`This test should pass`, async () => {
const driver = // configure your driver
await driver.getServerInfo()
await Promise.resolve((res: any) => setTimeout(res, 6000));
expect (1)
.toEqual(1);
});
});
Set a breakpoint at both awaits
then start debugging. I noticed when I hit the first breakpoint, wait a second or two, then step to the next breakpoint, the test will skip over the second breakpoint and claim the test failed with a timeout. If I press skip to the next breakpoint again, the second await is finally hit. It looks to me like something might not be properly awaited/resolved within the getServerInfo() code itself based on this.
My Environment
Javascript Runtime Version: node 16.13.2
Driver Version: 5.5.0
Neo4j Version and Edition: 1.5.7
Operating System: Windows 10
Hey @ToucanBran, thanks for reporting.
Could you please increase the test timeout out to 2 minutes or so, and check the error thrown by the getServerInfo()
?
describe('getServerInfo() Test', () => {
test(`This test should pass`, async () => {
const driver = // configure your driver
await driver.getServerInfo()
await Promise.resolve((res: any) => setTimeout(res, 6000));
expect (1)
.toEqual(1);
}, 120000);
});
Meanwhile, I will setup a small environment for replicating and debugging this scenario.
I don't believe getServerInfo
is throwing an error because i've surrounded it in a try/catch and the catch never is hit. When debugging it's almost as if it's not actually being awaited. Increasing the timeout does cause the behavior to stop I can't imagine it takes 5 seconds (default timeout) for getServerInfo to complete
I've tried to reproduce the issue, but I wasn't able to. Could you provide a minimal setup which the errors always happens or logs?
Issue closed due long inactivity. Please, open again this issue in case of new evidences.