-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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/fix(client): await blocking IO #13169
Conversation
await prisma.$disconnect() | ||
}) | ||
|
||
test('engines', async () => { |
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.
Is there a reason you merged this into a single test?
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.
I have changed this back to what it was before. I initially changed this test because when running the test it I get:
(node:39400) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
(node:39400) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGTERM listeners added to [process]. Use emitter.setMaxListeners() to increase limit
Then secondly because its running all theses tests sequentially:
client engine
√ expects(binary) | PRISMA_CLIENT_ENGINE_TYPE=binary | engineType=binary (2585 ms)
√ expects(library) | PRISMA_CLIENT_ENGINE_TYPE=library | engineType=binary (1641 ms)
√ expects(binary) | PRISMA_CLIENT_ENGINE_TYPE=undefined | engineType=binary (1953 ms)
√ expects(binary) | PRISMA_CLIENT_ENGINE_TYPE=binary | engineType=library (1954 ms)
√ expects(library) | PRISMA_CLIENT_ENGINE_TYPE=library | engineType=library (1547 ms)
√ expects(library) | PRISMA_CLIENT_ENGINE_TYPE=undefined | engineType=library (1538 ms)
√ expects(binary) | PRISMA_CLIENT_ENGINE_TYPE=binary | engineType=undefined (1955 ms)
√ expects(library) | PRISMA_CLIENT_ENGINE_TYPE=library | engineType=undefined (1596 ms)
√ expects(library) | PRISMA_CLIENT_ENGINE_TYPE=undefined | engineType=undefined (1544 ms)
each making more than three calls to disk for each test.
packages/client/src/__tests__/integration/happy/client-engine/test.ts
Outdated
Show resolved
Hide resolved
Potentially stupid question: What is the difference of these to how it was run before? |
beforeAll(async () => { | ||
await fs.promises.copyFile(path.join(__dirname, 'dev.db'), path.join(__dirname, 'dev2.db')) |
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.
Probably doesn't matter in this case. Technically it'll even be kinda slower because of the overhead of creating a new task on the thread pool and then just waiting for it without doing anything else on the main thread (since there shouldn't be anything else running concurrently with the beforeAll
hook in one Jest worker), but the difference should be negligible.
I don't think there should be any observable difference in these cases, since all of these changes are in tests, and Jest only parallelises tests across multiple workers (separate Node.js processes each with their own event loop), it doesn't run tests concurrently in a single worker[1]. So what I wrote in a previous comment really applies to all or most of these changes to a certain extent, but in functions that are already [1]At least it tries not to, but sometimes, e.g., some leftover async tasks may be executing after a test times out. |
Or, rather, it shouldn't. If it somehow does on @danstarns's machine, it may be the reason behind #13092 |
Awaits blocking IO in client/integration tests:
Related: #13092