Fix test race conditions

This commit is contained in:
adrinr 2023-01-30 12:29:39 +00:00
parent 651c367f75
commit 7d279e2eca
3 changed files with 7 additions and 3 deletions

View File

@ -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()
})

View File

@ -6,7 +6,7 @@ import { EmailTemplatePurpose } from "../../../../constants"
describe("/api/global/email", () => {
const config = new TestConfiguration()
beforeAll(async () => {
beforeEach(async () => {
await config.beforeAll()
})

View File

@ -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