Prepopulate dbs
This commit is contained in:
parent
b2813db5db
commit
abdd658012
1 changed files with 11 additions and 2 deletions
|
@ -11,7 +11,7 @@ mocks.licenses.useUnlimited()
|
||||||
import { init as dbInit } from "../../db"
|
import { init as dbInit } from "../../db"
|
||||||
dbInit()
|
dbInit()
|
||||||
import env from "../../environment"
|
import env from "../../environment"
|
||||||
import { env as coreEnv } from "@budibase/backend-core"
|
import { db, env as coreEnv, StaticDatabases } from "@budibase/backend-core"
|
||||||
import {
|
import {
|
||||||
basicTable,
|
basicTable,
|
||||||
basicRow,
|
basicRow,
|
||||||
|
@ -151,7 +151,16 @@ class TestConfiguration {
|
||||||
this.defaultUserValues = this.populateDefaultUserValues()
|
this.defaultUserValues = this.populateDefaultUserValues()
|
||||||
if (context.isMultiTenant()) {
|
if (context.isMultiTenant()) {
|
||||||
this.tenantId = `tenant-${newid()}`
|
this.tenantId = `tenant-${newid()}`
|
||||||
context.updateTenantId(this.tenantId)
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Prepopulate dbs to avoid race conditions
|
||||||
|
await db.getDB(StaticDatabases.PLATFORM_INFO.name).checkSetup()
|
||||||
|
await db.getDB(StaticDatabases.PLATFORM_INFO.docs.install).checkSetup()
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err.status !== 409) {
|
||||||
|
throw err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.started) {
|
if (!this.started) {
|
||||||
|
|
Loading…
Reference in a new issue