Open trentm opened 9 months ago
It's strange the message tells about a table already existing
|error: create table "users" ("id" serial primary key, "user_name" varchar(255)) - relation "users" already exists
I could only reproduce it when I'm commenting out the teardownDb()
process of the fixture file. The 2nd time it fails with the same error because the DB & table is already existing.
diff --git a/test/instrumentation/modules/fixtures/use-knex-pg.mjs b/test/instrumentation/modules/fixtures/use-knex-pg.mjs
index 074b5307..f812f595 100644
--- a/test/instrumentation/modules/fixtures/use-knex-pg.mjs
+++ b/test/instrumentation/modules/fixtures/use-knex-pg.mjs
@@ -60,7 +60,7 @@ async function main() {
trans.end();
await knex.destroy();
- await teardownDb();
+ // await teardownDb();
}
}
Maybe we could update the fixture to check for existence of the table with https://knexjs.org/guide/schema-builder.html#hastable. We already have other fixtures that check for the existence of a resource before creating it (eg. client-s3 checks for existing bucket)
Maybe we could update the fixture to check for existence of the table
Yup, that would likely be good.
It would be nice to spend a little time trying to understand what has changed here. I didn't see anything obvious in https://nodejs.org/en/blog/release/v18.19.0 that hints at a change here.
As a total guess: is this a timing issue? That test file has some in-process usage and out-of-process (via runTestFixtures
) usage. Could the in-process tests still have some incomplete shutdown (or state) before the test fixture is run?
"test/instrumentation/modules/pg/knex.test.js" fails with Node.js v18.19.0. It passes with v18.18.2.
This isn't currently showing up in our testing because we are currently pinning v18 testing to v18.18.2 for another reason: #3784