Remove no longer needed `LOG_CONTEXT` setting on logger module, update qa-core to disable pino logger via env var, add configurable jest timeout via env var
This commit is contained in:
parent
ea91605e2f
commit
c5337c652a
|
@ -1,6 +1,3 @@
|
|||
export * as correlation from "./correlation/correlation"
|
||||
export { logger } from "./pino/logger"
|
||||
export * from "./alerts"
|
||||
|
||||
// turn off or on context logging i.e. tenantId, appId etc
|
||||
export let LOG_CONTEXT = true
|
||||
|
|
|
@ -3,7 +3,6 @@ import pino, { LoggerOptions } from "pino"
|
|||
import * as context from "../../context"
|
||||
import * as correlation from "../correlation"
|
||||
import { IdentityType } from "@budibase/types"
|
||||
import { LOG_CONTEXT } from "../index"
|
||||
|
||||
// LOGGER
|
||||
|
||||
|
@ -83,15 +82,13 @@ if (!env.DISABLE_PINO_LOGGER) {
|
|||
|
||||
let contextObject = {}
|
||||
|
||||
if (LOG_CONTEXT) {
|
||||
contextObject = {
|
||||
tenantId: getTenantId(),
|
||||
appId: getAppId(),
|
||||
automationId: getAutomationId(),
|
||||
identityId: identity?._id,
|
||||
identityType: identity?.type,
|
||||
correlationId: correlation.getId(),
|
||||
}
|
||||
contextObject = {
|
||||
tenantId: getTenantId(),
|
||||
appId: getAppId(),
|
||||
automationId: getAutomationId(),
|
||||
identityId: identity?._id,
|
||||
identityType: identity?.type,
|
||||
correlationId: correlation.getId(),
|
||||
}
|
||||
|
||||
const mergingObject: any = {
|
||||
|
|
|
@ -12,6 +12,8 @@ function init() {
|
|||
BB_ADMIN_USER_EMAIL: "admin",
|
||||
BB_ADMIN_USER_PASSWORD: "admin",
|
||||
LOG_LEVEL: "info",
|
||||
JEST_TIMEOUT: "60000",
|
||||
DISABLE_PINO_LOGGER: "1"
|
||||
}
|
||||
let envFile = ""
|
||||
Object.keys(envFileJson).forEach(key => {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
process.env.DISABLE_PINO_LOGGER = "1"
|
||||
import { DEFAULT_TENANT_ID, logging } from "@budibase/backend-core"
|
||||
import { DEFAULT_TENANT_ID } from "@budibase/backend-core"
|
||||
import { AccountInternalAPI } from "../account-api"
|
||||
import * as fixtures from "../internal-api/fixtures"
|
||||
import { BudibaseInternalAPI } from "../internal-api"
|
||||
|
@ -7,10 +6,6 @@ import { Account, CreateAccountRequest, Feature } from "@budibase/types"
|
|||
import env from "../environment"
|
||||
import { APIRequestOpts } from "../types"
|
||||
|
||||
// turn off or on context logging i.e. tenantId, appId etc
|
||||
// it's not applicable for the qa run
|
||||
logging.LOG_CONTEXT = false
|
||||
|
||||
const accountsApi = new AccountInternalAPI({})
|
||||
const internalApi = new BudibaseInternalAPI({})
|
||||
|
||||
|
@ -24,7 +19,7 @@ async function createAccount(): Promise<[CreateAccountRequest, Account]> {
|
|||
await accountsApi.accounts.validateEmail(account.email, API_OPTS)
|
||||
await accountsApi.accounts.validateTenantId(account.tenantId, API_OPTS)
|
||||
const [res, newAccount] = await accountsApi.accounts.create(
|
||||
account, {...API_OPTS, autoVerify: true})
|
||||
account, {...API_OPTS, autoVerify: true })
|
||||
await updateLicense(newAccount.accountId)
|
||||
return [account, newAccount]
|
||||
}
|
||||
|
@ -32,7 +27,7 @@ async function createAccount(): Promise<[CreateAccountRequest, Account]> {
|
|||
const UNLIMITED = { value: -1 }
|
||||
|
||||
async function updateLicense(accountId: string) {
|
||||
await accountsApi.licenses.updateLicense(accountId, {
|
||||
const [response] = await accountsApi.licenses.updateLicense(accountId, {
|
||||
overrides: {
|
||||
// add all features
|
||||
features: Object.values(Feature),
|
||||
|
@ -50,7 +45,12 @@ async function updateLicense(accountId: string) {
|
|||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}, { doExpect: false })
|
||||
if (response.status !== 200) {
|
||||
throw new Error(
|
||||
`Could not update license for accountId=${accountId}: ${response.status}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async function loginAsAdmin() {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { logging } from "@budibase/backend-core"
|
||||
logging.LOG_CONTEXT = false
|
||||
|
||||
jest.setTimeout(60000)
|
||||
const envTimeout = process.env.JEST_TIMEOUT
|
||||
const timeout = envTimeout && parseInt(envTimeout)
|
||||
jest.setTimeout(timeout || 60000)
|
||||
|
|
Loading…
Reference in New Issue