* Parallel CI * Add build to integration test * Add checkout to top of each run * Revert branch update for ci job * Experiment with --runInBand for CI * Fix intermittent backend-core migration test failure * Fix hanging worker redis connection * Update naming from reset to newTenant
36 lines
690 B
TypeScript
36 lines
690 B
TypeScript
import "./mocks"
|
|
import * as structures from "./structures"
|
|
import * as testEnv from "./testEnv"
|
|
import * as context from "../../src/context"
|
|
|
|
class DBTestConfiguration {
|
|
tenantId: string
|
|
|
|
constructor() {
|
|
// db tests need to be multi tenant to prevent conflicts
|
|
testEnv.multiTenant()
|
|
this.tenantId = structures.tenant.id()
|
|
}
|
|
|
|
newTenant() {
|
|
this.tenantId = structures.tenant.id()
|
|
}
|
|
|
|
// TENANCY
|
|
|
|
doInTenant(task: any) {
|
|
return context.doInTenant(this.tenantId, () => {
|
|
return task()
|
|
})
|
|
}
|
|
|
|
getTenantId() {
|
|
try {
|
|
return context.getTenantId()
|
|
} catch (e) {
|
|
return this.tenantId!
|
|
}
|
|
}
|
|
}
|
|
|
|
export default DBTestConfiguration
|