Repository navigation
Refactor connection setup in vitest and fix connection cache - #3458
SanjulaGanepola wants to merge 5 commits into
Conversation
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
|
I am still in the process of finding a machine we can use for our CI. The machine I had switched to originally is too slow. |
|
👋 A new build is available for this PR based on be12e17. |
|
@SanjulaGanepola thanks for the refactor. I found two things that look blocking, plus a few smaller ones. We have also a conflict to be fixed...
Nice to have...
|
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
|
All points have been addressed. Some comments:
This is the same behavior as before. The tests can't know when something has been upgraded on the system. So it would be up to the person running the tests to clear the cache before running the tests again.
This only impacts any previous tests runs locally before this PR. This can be avoided by just deleting the file. Do you prefer reverting back to
I don't quite follow. The setup and connection cannot re-use the same. Setup is only a setup script run in |
buzzia2001
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. Agreed on 4 and 5: the new check is already stricter than the old file-existence one, and the rename only affects local caches, so no need to go back to _test.
One thing is still open: tools/sqlSignature.ts line 84 still imports ../src/api/tests/connection, which no longer exists after the move to setup/connection, so npm run sqlsignature breaks.
node:internal/modules/esm/resolve:274
throw new ERR_MODULE_NOT_FOUND(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\andrea.buzzi\Git\Code4i\Core\src\api\tests\connection' imported from C:\Users\andrea.buzzi\Git\Code4i\Core\tools\sqlSignature.ts
at finalizeResolution (node:internal/modules/esm/resolve:274:11)
at moduleResolve (node:internal/modules/esm/resolve:864:10)
at defaultResolve (node:internal/modules/esm/resolve:990:11)
at #cachedDefaultResolve (node:internal/modules/esm/loader:737:20)
at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:773:38)
at nextStep (node:internal/modules/customization_hooks:189:26)
at resolveBaseSync (file:///C:/Users/andrea.buzzi/AppData/Local/npm-cache/_npx/fd45a72a545557e9/node_modules/tsx/dist/register-nyXW-TH3.mjs:2:11092)
at resolveDirectorySync (file:///C:/Users/andrea.buzzi/AppData/Local/npm-cache/_npx/fd45a72a545557e9/node_modules/tsx/dist/register-nyXW-TH3.mjs:2:12398)
at resolveTsPathsSync (file:///C:/Users/andrea.buzzi/AppData/Local/npm-cache/_npx/fd45a72a545557e9/node_modules/tsx/dist/register-nyXW-TH3.mjs:2:13605)
at resolve (file:///C:/Users/andrea.buzzi/AppData/Local/npm-cache/_npx/fd45a72a545557e9/node_modules/tsx/dist/register-nyXW-TH3.mjs:2:16832) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///C:/Users/andrea.buzzi/Git/Code4i/Core/src/api/tests/connection'
}
Changes
This PR refactors the connection setup code used in vitest so it is more structured and includes more setup logs. It also addresses an issue where the cache in
.storage.jsonand.config.jsonwas being re-used even though the connection in the.envfile was different than what was cached.How to test this PR
npm run testChecklist