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 * as correlation from "./correlation/correlation"
|
||||||
export { logger } from "./pino/logger"
|
export { logger } from "./pino/logger"
|
||||||
export * from "./alerts"
|
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 context from "../../context"
|
||||||
import * as correlation from "../correlation"
|
import * as correlation from "../correlation"
|
||||||
import { IdentityType } from "@budibase/types"
|
import { IdentityType } from "@budibase/types"
|
||||||
import { LOG_CONTEXT } from "../index"
|
|
||||||
|
|
||||||
// LOGGER
|
// LOGGER
|
||||||
|
|
||||||
|
@ -83,15 +82,13 @@ if (!env.DISABLE_PINO_LOGGER) {
|
||||||
|
|
||||||
let contextObject = {}
|
let contextObject = {}
|
||||||
|
|
||||||
if (LOG_CONTEXT) {
|
contextObject = {
|
||||||
contextObject = {
|
tenantId: getTenantId(),
|
||||||
tenantId: getTenantId(),
|
appId: getAppId(),
|
||||||
appId: getAppId(),
|
automationId: getAutomationId(),
|
||||||
automationId: getAutomationId(),
|
identityId: identity?._id,
|
||||||
identityId: identity?._id,
|
identityType: identity?.type,
|
||||||
identityType: identity?.type,
|
correlationId: correlation.getId(),
|
||||||
correlationId: correlation.getId(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mergingObject: any = {
|
const mergingObject: any = {
|
||||||
|
|
|
@ -12,6 +12,8 @@ function init() {
|
||||||
BB_ADMIN_USER_EMAIL: "admin",
|
BB_ADMIN_USER_EMAIL: "admin",
|
||||||
BB_ADMIN_USER_PASSWORD: "admin",
|
BB_ADMIN_USER_PASSWORD: "admin",
|
||||||
LOG_LEVEL: "info",
|
LOG_LEVEL: "info",
|
||||||
|
JEST_TIMEOUT: "60000",
|
||||||
|
DISABLE_PINO_LOGGER: "1"
|
||||||
}
|
}
|
||||||
let envFile = ""
|
let envFile = ""
|
||||||
Object.keys(envFileJson).forEach(key => {
|
Object.keys(envFileJson).forEach(key => {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
process.env.DISABLE_PINO_LOGGER = "1"
|
import { DEFAULT_TENANT_ID } from "@budibase/backend-core"
|
||||||
import { DEFAULT_TENANT_ID, logging } from "@budibase/backend-core"
|
|
||||||
import { AccountInternalAPI } from "../account-api"
|
import { AccountInternalAPI } from "../account-api"
|
||||||
import * as fixtures from "../internal-api/fixtures"
|
import * as fixtures from "../internal-api/fixtures"
|
||||||
import { BudibaseInternalAPI } from "../internal-api"
|
import { BudibaseInternalAPI } from "../internal-api"
|
||||||
|
@ -7,10 +6,6 @@ import { Account, CreateAccountRequest, Feature } from "@budibase/types"
|
||||||
import env from "../environment"
|
import env from "../environment"
|
||||||
import { APIRequestOpts } from "../types"
|
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 accountsApi = new AccountInternalAPI({})
|
||||||
const internalApi = new BudibaseInternalAPI({})
|
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.validateEmail(account.email, API_OPTS)
|
||||||
await accountsApi.accounts.validateTenantId(account.tenantId, API_OPTS)
|
await accountsApi.accounts.validateTenantId(account.tenantId, API_OPTS)
|
||||||
const [res, newAccount] = await accountsApi.accounts.create(
|
const [res, newAccount] = await accountsApi.accounts.create(
|
||||||
account, {...API_OPTS, autoVerify: true})
|
account, {...API_OPTS, autoVerify: true })
|
||||||
await updateLicense(newAccount.accountId)
|
await updateLicense(newAccount.accountId)
|
||||||
return [account, newAccount]
|
return [account, newAccount]
|
||||||
}
|
}
|
||||||
|
@ -32,7 +27,7 @@ async function createAccount(): Promise<[CreateAccountRequest, Account]> {
|
||||||
const UNLIMITED = { value: -1 }
|
const UNLIMITED = { value: -1 }
|
||||||
|
|
||||||
async function updateLicense(accountId: string) {
|
async function updateLicense(accountId: string) {
|
||||||
await accountsApi.licenses.updateLicense(accountId, {
|
const [response] = await accountsApi.licenses.updateLicense(accountId, {
|
||||||
overrides: {
|
overrides: {
|
||||||
// add all features
|
// add all features
|
||||||
features: Object.values(Feature),
|
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() {
|
async function loginAsAdmin() {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { logging } from "@budibase/backend-core"
|
const envTimeout = process.env.JEST_TIMEOUT
|
||||||
logging.LOG_CONTEXT = false
|
const timeout = envTimeout && parseInt(envTimeout)
|
||||||
|
jest.setTimeout(timeout || 60000)
|
||||||
jest.setTimeout(60000)
|
|
||||||
|
|
Loading…
Reference in New Issue