This commit is contained in:
Sam Rose 2024-11-05 15:13:34 +00:00
parent d1e83ce4f7
commit b2d80d7dcc
No known key found for this signature in database
2 changed files with 16 additions and 19 deletions

View File

@ -1,4 +1,7 @@
import { datasourceDescribe } from "../../../integrations/tests/utils"
import {
DatabaseName,
datasourceDescribe,
} from "../../../integrations/tests/utils"
import tk from "timekeeper"
import emitter from "../../../../src/events"
@ -81,11 +84,10 @@ async function waitForEvent(
}
datasourceDescribe(
{ name: "/rows (%s)" },
{ name: "/rows (%s)", exclude: [DatabaseName.MONGODB] },
({ config, dsProvider, isInternal, isMSSQL, isOracle }) => {
let datasource: Datasource | undefined
let client: Knex | undefined
let table: Table
beforeAll(async () => {

View File

@ -10,7 +10,7 @@ import { GenericContainer, StartedTestContainer } from "testcontainers"
import { testContainerUtils } from "@budibase/backend-core/tests"
import cloneDeep from "lodash/cloneDeep"
import { Knex } from "knex"
import TestConfiguration from "src/tests/utilities/TestConfiguration"
import TestConfiguration from "../../../tests/utilities/TestConfiguration"
export type DatasourceProvider = () => Promise<Datasource | undefined>
@ -63,6 +63,8 @@ async function createDatasources(
config: TestConfiguration,
name: DatabaseName
): Promise<DatasourceDescribeReturnPromise> {
await config.init()
const rawDatasource = await getDatasource(name)
let datasource: Datasource | undefined
@ -103,9 +105,14 @@ export function datasourceDescribe(
databases = databases.filter(db => !exclude.includes(db))
}
const config = new TestConfiguration()
const prepped = databases.map(name => {
return {
describe.each(databases)(name, name => {
const config = new TestConfiguration()
afterAll(() => {
config.end()
})
cb({
name,
config,
dsProvider: createDatasources(config, name),
@ -116,19 +123,7 @@ export function datasourceDescribe(
isMongodb: name === DatabaseName.MONGODB,
isMSSQL: name === DatabaseName.SQL_SERVER,
isOracle: name === DatabaseName.ORACLE,
}
})
describe.each(prepped)(name, args => {
beforeAll(async () => {
await args.config.init()
})
afterAll(() => {
args.config.end()
})
cb(args)
})
}