diff --git a/packages/worker/src/api/routes/global/tests/configs.spec.ts b/packages/worker/src/api/routes/global/tests/configs.spec.ts index f25fc01699..ee27c4d451 100644 --- a/packages/worker/src/api/routes/global/tests/configs.spec.ts +++ b/packages/worker/src/api/routes/global/tests/configs.spec.ts @@ -7,7 +7,7 @@ import { Config, context, events } from "@budibase/backend-core" describe("configs", () => { const config = new TestConfiguration() - beforeAll(async () => { + beforeEach(async () => { await config.beforeAll() }) diff --git a/packages/worker/src/api/routes/global/tests/email.spec.ts b/packages/worker/src/api/routes/global/tests/email.spec.ts index 9e65cda3c5..d71af18577 100644 --- a/packages/worker/src/api/routes/global/tests/email.spec.ts +++ b/packages/worker/src/api/routes/global/tests/email.spec.ts @@ -6,7 +6,7 @@ import { EmailTemplatePurpose } from "../../../../constants" describe("/api/global/email", () => { const config = new TestConfiguration() - beforeAll(async () => { + beforeEach(async () => { await config.beforeAll() }) diff --git a/packages/worker/src/sdk/users/users.ts b/packages/worker/src/sdk/users/users.ts index 5124a5c5b1..73c604e3ea 100644 --- a/packages/worker/src/sdk/users/users.ts +++ b/packages/worker/src/sdk/users/users.ts @@ -264,7 +264,11 @@ export const save = async ( builtUser._rev = response.rev await eventHelpers.handleSaveEvents(builtUser, dbUser) - await addTenant(tenantId, _id, email) + if (!env.isTest()) { + // Race conditions (existing in prod already) with multiple tests synchronising the global db + // https://github.com/Budibase/budibase/issues/6134 + await addTenant(tenantId, _id, email) + } await cache.user.invalidateUser(response.id) // let server know to sync user